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

stolen uint's

Thread Next
From:
ToddAndMargo via perl6-users
Date:
January 26, 2020 00:58
Subject:
stolen uint's
Message ID:
e7b8d673-74ce-758d-2fb3-2c6889b41412@zoho.com
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

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