Jonathan Lang wrote:
 From S02:

--

Perl 6 includes a system of B<sigils> to mark the fundamental
structural type of a variable:

   $   scalar (object)
   @   ordered array
   %   unordered hash (associative array)
   &   code/rule/token/regex
   ::  package/module/class/role/subset/enum/type/grammar
   @@  multislice view of @

while we are at it:
:: and & are _really_ sigils for variables?
They seem (to me) more akin to a literal syntax, and I wonder what would happen in a case like this:

sub foo {}
sub bar {}
# currently syntax error in pugs, but if is a variable sigil
# why I can't have it on a variable?
my &foo = &bar;
&foo('hello')

I have to understand that
 &foo = &somefunction
is actually redefining the foo() sub?

If not, which gets called in the above case? can I have access again to the original &foo sub here?

and in these context

multi foo(Int $i) {...}
multi foo(Str $i) {...}

my &foo = &foo<Int>
&foo('hello')

do I get an error, since we are using the variant defined for Ints or is the multiple dispatch called again?

Same for ::
 ::Object = $?GRAMMAR
is guaranteed to explode in my face or is it just a syntactic error (as it currently is in pugs) ?

Reply via email to