On 2020-01-12 23:20, WFB wrote:
Hi Todd,
For years, I have been playing around with programming stuff. I never
stumbled across the term "cardinal". Its obvious that I am not an native
English speaker and it does not hurt to learn new stuff. But, you makes
it harder to understand your problems
On 2020-01-12 20:03, Darren Duncan wrote:
On 2020-01-09 10:10 a.m., ToddAndMargo via perl6-users wrote:
A bug to report:
$ p6 'my uint32 $c; $c = "ABC";'
This type cannot unbox to a native integer: P6opaque, Str
in block at -e line 1
"uint32" is not an "integer". It is a cardinal. If
the
Hi Todd,
For years, I have been playing around with programming stuff. I never
stumbled across the term "cardinal". Its obvious that I am not an native
English speaker and it does not hurt to learn new stuff. But, you makes it
harder to understand your problems if you not use the common jargon.
R
On 2020-01-12 18:23, ToddAndMargo via perl6-users wrote:
On 2020-01-12 16:05, Joseph Brenner wrote:
This can be done with an explicit, named subset if you like:
subset StrOrInt where Str | Int;
sub do_stuff ( StrOrInt $item ) {
say "$item is a " ~ $item.^name;
}
Hi Joseph,
I
On 2020-01-09 10:10 a.m., ToddAndMargo via perl6-users wrote:
A bug to report:
$ p6 'my uint32 $c; $c = "ABC";'
This type cannot unbox to a native integer: P6opaque, Str
in block at -e line 1
"uint32" is not an "integer". It is a cardinal. If
they really want to use the word "integer" for
On 2020-01-09 06:56, ToddAndMargo via perl6-users wrote:
mailto:perl6-users@perl.org>> wrote:
Hi All,
In a sub declaration, is there a way to constrain
a variable to only an "int32" or a "Str" (I want both)?
Or do I have to put up with the other types of "Any
On 2020-01-12 16:05, Joseph Brenner wrote:
This can be done with an explicit, named subset if you like:
subset StrOrInt where Str | Int;
sub do_stuff ( StrOrInt $item ) {
say "$item is a " ~ $item.^name;
}
Hi Joseph,
I like it.
Now to figure where to put it so it is apparent
As I was next to you in today's Raku gathering, I came up with this as a
sort-of answer. Not very happy with it but it gets partway there.
#!/usr/bin/env perl6
use v6.d;
## Simple version to check membership, but the type error won't tell which
strings
# subset Critter of Str where any
## This
Moving the definition of the subset outside of the class
covers for the weird behavior...
my @allowed = << alpha beta gamma delta >>;
my @default = << alpha >>;
subset Allowed of Str where * eq any( @allowed );
class HasSubset {
has Allowed @.grk = @default;
method echo_grk {
Here's a code snippet that tries to use a subset to constrain the
values of an object field (i.e. declared with has). As written, this
code works, but only when there's what looks like an irrelevant
experimental line in it (labeled "WEIRD ONE"), when that line is
commented out it throws an error..
This can be done with an explicit, named subset if you like:
subset StrOrInt where Str | Int;
sub do_stuff ( StrOrInt $item ) {
say "$item is a " ~ $item.^name;
}
On 1/9/20, ToddAndMargo via perl6-users wrote:
mailto:perl6-users@perl.org>> wrote:
Hi All,
I was just playing around with using a "subset" to restrict a
string to a set of allowed values:
subset Monster of Str where * eq any( << godzilla mothera blob
tingler grendel minotaur >> );
my Monster $thingie;
$thingie = 'grendel'; # accepts this as expected
$thingie = 'nada'; # f
I downloaded the Rakudo Star 2019.11-rc1 source installer from
https://dist.tyil.nl/raku/rakudo-star/ and built it on OS X 10.15.2
"Catalina", rakudo-test complains about Native Call, and also that a couple
TODO's pass
*Test Summary Report*
t/04-nativecall/20-concurrent.t
Here is one reason why you do these to to be
distinct from each other. In Win API calls to the
registry, REG_DWORDs are all cardinals, not
integers:
Here is a link to the graphicsthat did not come out:
https://social.msdn.microsoft.com/Forums/getfile/1525734
On 2020-01-12 09:18, Marcel Timmerman
wrote:
On 1/9/20 7:10 PM, ToddAndMargo via
perl6-users wrote:
'my
uint32 $c; $c = "ABC";'
The error shows that you cannot assign a string to an int (This
type cannot unbox to a
On 1/9/20 7:10 PM, ToddAndMargo via perl6-users wrote:
'my uint32 $c; $c = "ABC";'
The error shows that you cannot assign a string to an int (*This type
cannot unbox to a native integer: P6opaque, Str*)
You can do the following to get it right;
'p6 -e 'my uint32 $c; $c = 0xABC;''
16 matches
Mail list logo