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:"?
Array-/Hash-like access is very natural for many objects and I think
deserves simplified syntax.

    method [] ($index) { .item $index }

    method {} ($key) { .arg $key }

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

Perhaps by making this popular, we can get rid of AUTOLOAD junkies ;)


Juerd

Reply via email to