Jarkko Hietaniemi writes:
: Maybe I missed it... but what is the relationship of (Perl 5) attributes
: and Perl 6 properties?
: 
:       my $answer : constant  = 42;
:       my $answer is constant = 42;
: 
:       my sub ... dang, no lexical subs, but can we please have them
:       in Perl6? :-)

Yes, there will certainly be lexical subs.  We might even go so far as
to rely on my/our to distinguish private methods from public without
actually having to declare methods as public or private.

:       sub terfuge : locked  { ... }
:       sub terfuge is locked { ... }

Perl 6 compile-time properties *are* Perl 5 attributes, give or take an
implementation interface or two.  Perl 6 run-time properties have no
counterpart in Perl 5 (unless you count dual-valued variables like $!,
or some of the other data that can be attached via magic).

We're calling them properties now instead of attributes because we
don't want people to confuse properties with object attributes (except
to the extent that we do).

The switch from ":" to "is" is motivated primarily by the fact that
we want the colon for far too many other things as well.  Plus, I just
think that

        my $answer is constant = 42;

makes it more visually clear that the assignment is to $answer, since
the "textiness" tends to clump everything before "=" together a little
better.  (At least, I think people can learn to read it that way, even
if it strikes them differently on first impression.)

Larry

Reply via email to