Skip to content

Instantly share code, notes, and snippets.

@pmichaud
Created June 13, 2013 04:08
Show Gist options
  • Save pmichaud/5771173 to your computer and use it in GitHub Desktop.
Save pmichaud/5771173 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/rakudo$ ./perl6
> my $h = Hash[Str,Int].new;
().hash
> $h{3} = 'hello'; # okay
hello
> $h{'hello'} = 'hello'; # fails key check
Nominal type check failed for parameter 'key'; expected Int but got Str instead
> $h{4} = 15; # fails value check
Type check failed in assignment to '$v'; expected 'Str' but got 'Int'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment