3 ms·
Perl 6 supports arbitrary run-time predicates as "subset" types: subset Foo where /foo/; subset Bar where 0 .. 99; subset Baz where * > rand;
by raiph 10y ago
Perl 6 supports arbitrary run-time predicates as "subset" types:
subset Foo where /foo/;
subset Bar where 0 .. 99;
subset Baz where * > rand;
my Foo \foovar = 'Some food';
my Bar \barvar = 42;
my Baz \bazvar = 0.5; # Fails typecheck half the time