TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:


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
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.

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 syntax:

Foo::<::Bar><::Baz> # same as Foo::Bar::Baz

And in S03:

Type names

   Num
   ::Some::Package


Class-qualified method call

   $obj.::Class::meth

In S06:

   is ::Foo[...]       # definitely a parameterized typename

In S10:

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.
--John



Reply via email to