Re: Variable attributes - Object-oriented

2000-10-01 Thread Peter Scott

At 02:52 PM 10/1/00 -0400, John Porter wrote:
>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!  :-)

I'd be happy to join this cause if the parser can disambiguate this use of 
: vs its appearance in the trinary operator.  Bearing in mind that a highly 
desirable extension would be user-defined variable attributes.
--
Peter Scott
Pacific Systems Design Technologies




Re: Variable attributes - Object-oriented

2000-10-01 Thread Nathan Wiger

> 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.
 
> Please tell me I'm right!  :-)

Pretty much; in fact I just submitted a frozen version of RFC 337 that
tries to extend and firm up this idea. I'm with you, man! ;-)

Since it's deadline time, the implementation didn't get too
super-specific. But the idea's there. Reply to the thread when it comes
out if there's any major holes that need to be plugged.

-Nate



Variable attributes - Object-oriented

2000-10-01 Thread John Porter

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