Skip to content

Clarify when prefix<::> can be used as in-place predeclarator #10

Merged
merged 5 commits into from Dec 1, 2012

2 participants

@skids
skids commented Jan 10, 2012

skids hrm.
rakudo: class A { multi method foo(::B $b) { say "Surprise! ::B is an en-passant type capture"; } }; class B { }; my B $b .= new(); my A $a .= new(); $a.foo($b); $a.foo(2);
p6eval rakudo 38165a: OUTPUT«Surprise! ::B is an en-passant type capture␤Surprise! ::B is an en-passant type capture␤»
PerlJam skids: why is that a surprise exactly?
skids It's a surprise to anyone who thought they were using ::B to use a class before it was declared.
(which is something they will probably learn well before learning what an en-passant type capture is)
jnthn skids: The rule is that ::B only works for talking about as yet undeclared types in non-declarative scenarios. A signature is declarative.

@xfix xfix merged commit fc0e3bd into perl6:master Dec 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.