Front page | perl.perl6.language |
Postings from May 2005
Re: $:attr vs $.:attr
From: Aaron Sherman
May 16, 2005 06:09
Re: $:attr vs $.:attr
Message ID: 1116248914.1567.2.camel@markab
On Mon, 2005-05-16 at 12:23 +0200, Juerd wrote:
> Aaron Sherman skribis 2005-05-16 5:54 (-0400):
> > I'm not sure I see that you changed anything
> Okay, let's try it differently, then:
[...something that looks like braille...]
And now, you've s/[\$\w]+//g; what point are you making, Juerd? I think
I've demonstrated that I get it. I just don't agree with your thesis
that that one character is a) a problem or b) inconsistent.
> > I think you're confusing the method glyph "." and the attribute glyph,
> > also "." in the first and second columns.
> It's the same thing.
Well, there's the problem. If you see those as the same symbol, then of
course this is deeply confusing. After all, "$.foo" doesn't behave
anything like a method, and yet it uses the method symbol.
Try looking at those two symbols as TWO SYMBOLS, and I think your life
"$.foo" -- Attribute glyph "." used after scalar variable glyph "$".
"$obj.foo" -- Method glyph "." used after scalar variable.
If you de-couple those in your mind, then there's
> $.foo installs an accessor *method*.
Well, it can. It won't if there's already a method there, of course, and
that's an important distinction. There's no fundamental tie between the
two. The auto-accessor is just a convenience that is placed there for
you if you didn't go out of your way to supply one. It's not "part of"
the attribute, and so we should not name the attribute in order to match
the naming of the method. If anything, we should do the reverse, but I'm
happy with the way it is.
> $object.foo calls that method, it doesn't access $object's $.foo
Yes, that's correct. That's because you're using the method-invocation
glyph. If you had used the attribute glyph ("$.foo"), then you would get
direct access. Are you telling me this because you didn't think I knew?
It certainly doesn't seem to further the point....
> > > Note that it's not *implicit* $?SELF. "./" is a prefix operator that
> > > calls a method on $?SELF
> > That's picking nits.
> In the process of designing something, every single nit must be picked.
> Don't take it personally.
You removed the context supplied by my next sentence. Your nit to which
I was referring was NOT a design comment, and I still hold that my
original usage of "implicit" is correct.