--- Juerd <[EMAIL PROTECTED]> wrote:
> Piers Cawley skribis 2004-07-12 12:20 (+0100):
> >   method postcircumfix:[] is rw { ... }
> 
> Compared to Ruby, this is very verbose.
> 
>     def [] (key)
>         ...
>     end
> 
>     # Okay, not entirely fair, as the Ruby version would also
>     # need []= defined for the rw part.
> 
> Could methods like "[]" and "{}" *default* to "postcircumfix:"?

Do we want Larry to spend even a picosecond thinking about how to
reduce the number of characters required to declare something like
this?

> Array-/Hash-like access is very natural for many objects and I think
> deserves simplified syntax.
> 
>     method [] ($index) { .item $index }
> 
>     method {} ($key) { .arg $key }

I thought operators were generally considered global multisubs, simply
because it makes life interesting when you're dereferencing $a[1, 2]
otherwise.

(Not that it matters, other than increasing the number of places that
MMD has to search for candidates.)

Regardless, I don't agree that the huffman coding of postcircumfix:[]
needs to be reduced to that of "[]". You could write a pcf:[] macro, if
you wanted to.

> (And I'm assuming <<>> will be a method of Object that uses
> self.postcircumfix:{}.)

It seems intuitive that redefining one access would redefine the
other(s), but I want the override mechanism to be the same. I think
requiring a method definition for one notation and a multisub for the
other notation would be a mistake. So long as they are both overridden
as methods or both as subs, it's cool.

=Austin

Reply via email to