develooper Front page | perl.perl6.users | Postings from January 2020

Re: stolen uint's

Thread Previous | Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 26, 2020 02:23
Subject:
Re: stolen uint's
Message ID:
c2bcd441-c1f9-9530-b628-bf08fbef8be7@zoho.com
On 2020-01-25 16:58, ToddAndMargo via perl6-users wrote:
> Hi All,
> 
> Anyone have a workaround to my stolen uint's?
> 
>  > constant DWORD := uint32;
> (uint32)
> 
>  > subset StrOrDword where Str | DWORD;
> (StrOrDword)
> 
>  > sub x( StrOrDword $item ) {
> *       say "$item is a " ~ $item.^name;
> *   }
> &x
> 
>  > x( "abc" );
> abc is a Str
> 
>  > x( 3 );
> Constraint type check failed in binding to parameter '$item'; expected 
> StrOrDword but got Int (3)
>    in sub x at <unknown file> line 1
>    in block <unit> at <unknown file> line 1
> 
>  > x( 3.UInt );
> Constraint type check failed in binding to parameter '$item'; expected 
> StrOrDword but got Int (3)
>    in sub x at <unknown file> line 1
>    in block <unit> at <unknown file> line 1
> 
> 
> 
> Many thanks,
> -T



 > say DWORD.Range
0..4294967295

 > my DWORD $c=0xFF44;say $c.DWORD.Range
No such method 'DWORD' for invocant of type 'Int'
   in block <unit> at <unknown file> line 1

AAAAAHHHH!!!!!

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About