Re: $:attr vs $.:attr

2005-05-16 Thread Aaron Sherman
On Sun, 2005-05-15 at 19:18 +0200, Juerd wrote:
 Now:
   Declaration ExplicitImplicit $_ $?SELF
   has $.var | $obj.var \  .var \  ./var \
   has $:var | $obj.:var \ .:var \ ./:var \
 
 Consistent:
   has $.var \ $obj.var \  .var \  ./var \
   has $.:var \$obj.:var \ .:var \ ./:var \
 
 See it yet? It's about consistency in the whole scheme, not the clarity
 of a single element.

I'm not sure I see that you changed anything other than changing Old
way to Now, Your proposal to Consistent, adding separator
characters between the columns, and removing the word Implicit from
the last column.

I'm still not seeing the problem. Counting down and then right, I read
those: $. means attribute; $: means private attribute; $x. means
accessor method; $x.: means private accessor method; and so on...

I think you're confusing the method glyph . and the attribute glyph,
also . in the first and second columns. Consistency would be to make
accessor methods use both the attribute and accessor glyphs .., but
that would cause at least 4 problems that I can think of, so . is a
nice simple thing to do. In the case of private accessor methods, most
of those reasons go away, so .: needn't be (and in fact can't be)
shortened.

All of the details aside, I simply don't see newbies getting all that
confused. For starters, there's no particular reason that they would
have to use private attributes all that often, and if they did, they
don't really EVER have to use accessor methods on them, though style
might nudge them in that direction, there's no real impact on
scalability the way there is with regular accessors (because every use
of the private accessor is local to the class definition).

Now, the one place I can see that you should ALWAYS use the private
attribute accessors is in roles. Here, it would be essential, as you
don't know what the composing class might want to do to that method, so
the only place that I see this being a big concern is in roles that have
private attributes. Certainly an edge case newbies won't contend with
all that often, yes?

 Note that it's not *implicit* $?SELF. ./ is a prefix operator that
 calls a method on $?SELF

That's picking nits. I know that, but was referring to the implicit use
of $?SELF regardless of the syntax one would have to employ in order to
use it explicitly.




Re: $:attr vs $.:attr

2005-05-16 Thread Juerd
Aaron Sherman skribis 2005-05-16  5:54 (-0400):
 On Sun, 2005-05-15 at 19:18 +0200, Juerd wrote:
  Now:
  Declaration ExplicitImplicit $_ $?SELF
  has $.var | $obj.var \  .var \  ./var \
  has $:var | $obj.:var \ .:var \ ./:var \
  Consistent:
  has $.var \ $obj.var \  .var \  ./var \
  has $.:var \$obj.:var \ .:var \ ./:var \
  See it yet? It's about consistency in the whole scheme, not the clarity
  of a single element.
 I'm not sure I see that you changed anything other than changing Old
 way to Now, Your proposal to Consistent, adding separator
 characters between the columns, and removing the word Implicit from
 the last column.

Okay, let's try it differently, then:

Now:
Declaration ExplicitImplicit $_ $?SELF
 .| .\  .\  . \
 :| .:\ .:\ . :\

Consistent:
 .\ .\  .\  . \
 .:\.:\ .:\ . :\


 I think you're confusing the method glyph . and the attribute glyph,
 also . in the first and second columns.

It's the same thing. $.foo installs an accessor *method*. $object.foo
calls that method, it doesn't access $object's $.foo directly.

  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.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html


Re: $:attr vs $.:attr

2005-05-16 Thread Aaron Sherman
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
gets easier.

$.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
 directly.

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.




Re: $:attr vs $.:attr

2005-05-15 Thread Juerd
Now:
Declaration ExplicitImplicit $_ $?SELF
has $.var | $obj.var \  .var \  ./var \
has $:var | $obj.:var \ .:var \ ./:var \

Consistent:
has $.var \ $obj.var \  .var \  ./var \
has $.:var \$obj.:var \ .:var \ ./:var \

See it yet? It's about consistency in the whole scheme, not the clarity
of a single element.

(I wouldn't mind if $:var was a shortcut syntax for $.:var, although we
will regret this when we think of an even better purpose for the colon
as a sigil.)

Note that it's not *implicit* $?SELF. ./ is a prefix operator that
calls a method on $?SELF, not an infix operator that when prefixly used
defaults to something. ./ is not like .+ and friends. It cannot be
used infix, it does not default to anything. Read the two characters as
one.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html