Under my current design of containers (see "definition of containers" on p6c), there are only Scalar, Array and Hash containers. This is in accordance to them being the only first-class data structures that deals with mutable data storage.
This is similar to JVM's division between scalar data and collection data;
it's just Perl 6 introduces two collections with differnet interfaces.
With the elimination of the * sigil and the *{} dereferencer, the only
unresolved sigil type is &. Unlike collections, it is really difficult
to tell the difference between $code and &{$code}. Moreover, it makes
little sense to say:
tie(&code, TiedCode);
Since it is much easier to just wrap the &code in place.
All this led us to think about whether (my &foo) can be merely treated
the same as (my Code $foo). The mutable form will enable convenient
notations such as:
&foo = sub { ... };
So instead of having to explain to newcomers that you cannot assign
to a &-sigil symbol, it would all just work. Under this view, &{$x}
would be eliminated with *{}.
Another idea is to treat (my &foo) the same way (my Code $foo is constant).
That will discourage people into assigning into functions, and enable
the compiler to detect function variables at lvalue position as errors,
but on the whole I don't think it's worth the complexity.
Does this make sense?
Thanks,
/Autrijus/
pgpj7nm6vrf1v.pgp
Description: PGP signature
