Damian Conway:
# Scott wrote:
#
#    > Actually, I think it becomes:
#    >
#    >  sub foo is method {
#    >     my $old = .foo;
#    >     .foo = shift if @_;
#    >     return $old;
#    >  }
#    >
#    > But, I could be wrong.  Any Damians care to enlighten?  :-)
#
# Well, I'm not a Damian, but I play one on perl6-language. ;-)

Well, then, where's a *real* Damian?  :^)

# The final syntax for new-style Perl6 OO is currently "in flux", or
# perhaps we should say: "its superposition has yet to collapse to a
# stable eigenstate". Larry has ideas, I have ideas, and I'm working on
# integrating them into a coherent proposal.
#
# However, I don't think the above syntax will be it. I think
# it would likely
# be closer to:
#
#         class Demo {
#
#             my $.foo;
#
#             method foo {
#                 my $old = $.foo;
#                 $.foo = @_[1] if @_ > 1;
#                 return $old;
#             }
#         }

So it is gonna be C<class IDENT [is property_list] BLOCK>?  Hurray!

I assume we're going to recycle 'my' and 'our' to be 'instance' and
'class'--is that correct?

# Though, in fact, the idiom in Perl 6 would probably be to use
# just use lvalue methods:
#
#         class Demo {
#
#             my $.foo;
#
#             method foo is lvalue {
#                 return $.foo
#             }
#         }

Will that be lvalue or rw?  I could see it being rw, to keep the number
of intrinsic properties to a minimum, and since it's a nice analogy to
rw parameters.  (Plus we might want to reserve lvalue for more magical
lvalue tricks--sort of a poor man's tie().)

# Nor am I yet convinced of the need for a separate
# C<$.attribute> syntax,
# so it *might* just be:
#
#         class Demo {
#
#             my $foo;
#
#             method foo is lvalue {
#                 return $foo;
#             }
#         }

What if we have an instance variable $foo and a global $foo, and we want
to access the global?

# The unary dot operator would only be used for method calls:
#
#         method bar {
#                 my $realfoo = .foo;
#                 .foo = 'bar';
#                 .baz();
#                 .foo = $realfoo;
#         }
#
# to avoid the endless calls to self():
#
#         method bar {
#                 my $realfoo = self.foo;
#                 self.foo = 'bar';
#                 self.baz();
#                 self.foo = $realfoo;
#         }

Are we still gonna be able to pick what we call the current instance?
>From previous programming languages, I'm a lot more comfortable with $me
or $this than $self.  (Yeah, it's a little thing, but it's something I
*liked* about Perl 5's OO--it showed how you had flexibility.  And I
*like* that flexibility, dammit!)  Perhaps:

        method bar {
                ...
        }

will assume $self, but:

        method bar($me : *@_) {
                ...
        }

will use $me instead.

# Aaron then asked:
#
#    > Also, the "sub .foo" syntax is one I've now seen in an
# apocolypse and
#    > the good ensign's article, so I'm not sure where "sub
# foo is method" is
#    > coming from.
#
# Those alternate universe syntaxes coming from quantum fluctuations in
# the uncollapsed syntax superposition. I'll soon be firing a polaron
# burst through the main deflector in a desparate attempt to stabilize
# this anomoly before it destroys Perl 6.

All these Star Trek references are threatening to make my warp core
breach...  :^)

--Brent Dax
[EMAIL PROTECTED]
Configure pumpking for Perl 6

When I take action, I’m not going to fire a $2 million missile at a $10
empty tent and hit a camel in the butt.
    --Dubya

Reply via email to