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 @

C<$x> may be bound to any object, including any object that can be
bound to any other sigil.

C<@x> may be ... bound to any object that does the C<Positional> role

C<%x> may be bound to any object that does the C<Associative> role

C<&x> may be bound to any object that does the C<Callable> role

C<::x> may be bound to any object that does the C<Abstract> role

--

IIRC, could the above section about C<$x> be considered equivalent to
saying that C<$x> may be bound to any object that does the C<Object>
role?

Also, a possible change in terminology:

 s/C<Positional>/C<< sigil:<@> >>/
 s/C<Associative>/C<< sigil:<%> >>/
 s/C<Callable>/C<< sigil:<&> >>/
 s/C<Abstract>/C<< sigil:<::> >>/
 s/C<Object>/C<< sigil:<$> >>/ if every object does the Object role

This would free up more role names for programmer use.  It would also
imply that one could create a new sigil by defining a role named
'sigil:<...>', with the behavior of the sigil being established by the
definition of the role.  Or does this make it too easy to create new
sigils?

--
Jonathan "Dataweaver" Lang

Reply via email to