Peter Scott wrote:
> At 02:21 PM 10/1/00 -0400, John Porter wrote:
> >
> > my @a :base(1);
> >
> >How do you set an attribute on a global variable?
>
> [indeed,] how do you apply the attribute to anonymous,
> let alone autovivified, arrays?
I believe that mentioning an attribute of a variable is
really a method call on the variable's underlying object --
which, in perl6, can have user-definable behavior.
Where some language use dot or arrow syntax, perl uses colon.
Very isomorphic.
And that means any anonymous structure is available for
attributification via normal deref syntax:
@{ $a[1] }:base(2); # but I've never seen a script that did this...
%{ $hr }:keys( qw( name age strangeness ) );
And globals too:
@known_objects:size(100);
Oo:
for my $i ( 0 .. @a:last_index ) { # deprecate $#a
Please tell me I'm right! :-)
--
John Porter
Think I saw you in an ice cream parlour
Drinking milkshakes cold and long