Created
October 21, 2015 14:18
-
-
Save anonymous/87f0f253547ae2fc6404 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head2 What is C<(Any)> and why is it undefined? | |
In Perl 6 any container got a type. If no type is provided it will default to L<Any|type/Any>. However, any instance of Any is | |
a defined value. | |
my $foo; | |
say $foo.WHAT # "(Any)" whereby the parenteses indicate the type object | |
say so $foo.DEFINITE; # "False" | |
my $bar = Any.new; | |
say $bar.WHAT # "(Any)" | |
say so $bar.DEFINITE; # "True" as it's an instance of Any | |
Any type check Perl 6 does will ask C<.DEFINITE> for help. The user level interface are type smilies. | |
my $foo; # is of Type any and undefined | |
my Any:D $bar = $foo; # Maybe a runtime or compile time error | |
sub foo(Any:D $someparam){} | |
foo($foo); # Maybe a runtime or compile time error | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment