On Wed, Apr 20, 2005 at 08:39:02AM +0200, Leopold Toetsch wrote:
: Larry Wall <[EMAIL PROTECTED]> wrote:
: > On Tue, Apr 19, 2005 at 02:02:41PM +0000, Ingo Blechschmidt wrote:
: 
: >:     # Possibility #2
: >:     multi sub *postcircumfix:<'[', ']'>(TiedArray $self, $index) {
: >:       # Body as above
: >:     }
: 
: > None of those are quite right, because you have to be prepared to deal
: > not only with slices, but with multiple dimensions of slices.
: 
: Then again the question arises, if all the possible indexed access isn't
: clearer written as multi subs:
: 
:   multi sub *postcircumfix:<[ ]>(TiedArray $self, int $index) {...}
:   multi sub *postcircumfix:<[ ]>(TiedArray $self, Int $index) {...}
:   multi sub *postcircumfix:<[ ]>(TiedArray $self, Slice $index) {...}
:   multi sub *postcircumfix:<[ ]>(TiedArray $self, MyDims $index) {...}
: 
: or with FETCH and STORE as distinct variants too, and r/w ...

Depends on whether the user is actually expecting equal MMD there,
or tie-breaking between multi methods within the particular class.
My gut-level feeling is that they expect the latter.

: > ...  However, that being
: > said, there's enough flexibility in the FETCH/STORE proxy that you
: > could "defactor" the identification code out to the various handlers
: > and get the same benefit.
: 
: Well, isn't the "defactorized" code just a bunch of multi subs?

I don't think of it that way.  Considering the code is bound to a
particular proxy object before it is ever called, it seems to fall
even more into the category of multi method rather than multi sub.

This is one of the big flying leaps that Perl 6 is trying to take.
We've had lots of MMD implementations in the world, but Perl 6 is
attempting to make that orthogonal to all the other scoping mechanisms,
including lexical scopes and class scopes.  If there's prior art,
I'm not aware of it.  I suppose the non-brain-burning view of it is
that any extra lexical or class scope dimension just turns into an
extra absolute constraint on which subset of the global subs of that
short name can be called.

Larry

Reply via email to