Melvin Smith <[EMAIL PROTECTED]> writes: > At 09:23 AM 4/10/2002 +0100, Piers Cawley wrote: >>Okay, this is the beginnings of Scheme in Perl6. I'm sure there's >>stuff I'm getting wrong. I've not written the parser yet for instance > > Very nice! Quite a sample, maybe Larry/Damian can use this > in one of the next $(A,E)'s > > >> my SchemeExpr $.value; > > I haven't been keeping up in the back, I've a wedding bearing down on me. > > What is the significance of the . in the declaration?
class Class { my $class_variable; my $.instance_variable; ... } Easy eh? > I think I paid attention enough to know a little about the unary dot > but I'm still confused. We are able to use .foo to mean self.foo, > but I would assume foo would be declared with my Foo $foo, not my > Foo $.foo ? > >> method car { .value.key } >> method cdr { .value.value } > > Maybe its the C++ in me but why the use of the unary . inside methods > of the current class who's scope includes C<value> already? Consider class SpecializedPair is SchemePair { method value {...} } If you've written 'cdr' without the unary . it will attempt to dispatch to a *subroutine* in the same context, ie SchemePair::value. Even assuming that we play nice and allow confusion between methods and subroutines (which I'm personally not keen on), it's still apparent that, in the case of a SpecializedPair, car and cdr would use the wrong &value. > Isn't this like using C<this> in C++ from inside a non-static method? Don't ask me. I know nothing about C++ -- Objective C (Looong ago), Perl 5, Smalltalk and Ruby for me. > I'll await your ruler on my knuckles, but overall; very impressed > here. Thanks. Wait for the next version though, I'm busy implementing lexical scopes at the moment. -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite." -- Jane Austen?