TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
You appear to be saying that any use of Type with the sigil ::Type, in a
signature where a type is expected, makes it generic and declares it
hiding any outer value.
Which is no problem if ::T defines it in the lexical scope. Any
outer definition is hidden. I guess re-using ::T in the same scope
again for capturing a new type is an error. Just like redeclaring
a value variable. BTW is
Reading S02 again, I see that is explained.
"C<::> can serve as its own sigil indicating intentional use of a
not-yet-declared package name."
But the synopses uses ::Type to empasize that it is a Type, e.g. "$spot
is initialized with ::Dog".
In one case it is used for a Signature.
my ::MySig ::= :(Int, Num, Complex, Status)
And here it is used to indicate "type" so as not to run into reserved
Foo::<::Bar><::Baz> # same as Foo::Bar::Baz
And in S03:
Class-qualified method call
is ::Foo[...] # definitely a parameterized typename
Since there are no barewords in Perl 6, package names must be predeclared,
or use the sigil-like C<::PackageName> syntax. The C<::> prefix does not
imply top-levelness as it does in Perl 5. (Use C<::*> for that.)
$obj.Class::meth # same thing, assuming Class is predeclared
Finally, in S12:
In an rvalue context the C<::> prefix is a no-op, but in a declarational
context, it binds a new type name within its declared scope.
So, I agree with your reading. But I don't like it.