Thomas Sandlaà writes:
> Larry Wall wrote:
> >Yes.  It should complain that = is not a valid type signature.
> >Any &foo (or &foo:<...>) followed by <...> should be parsed as a single
> >term selecting the function that MMD would dispatch to given that
> >type signature.
> 
> And I guess it's not allowed to have interspersed whitespace unless
> one uses the dot forms? And my interpretation as operator <=> needs
> the whitespace OTOH.
> 
> &infix <=> <some words>  # my interpretation of the typo
> 
> &foo  .<signature>  # OK?

I'm beginning to think that angle brackets are too overloaded here.  The
qw angles are really growing on me, and now whenever I see angles I see
a quoting construct.  Putting something that's not quoted inside them
seems like it will be visually confusing (and just thing what vim will
have to do to tell the difference).

We could make it one, so that it's:

    &infix:<+>.<Complex Complex>

Instead of with commas, but then you can't attach anything special to
the types, so I think it's best if we just ditch <> altogether for this
purpose.

But then what replaces it?    The first thing that came to me was just
to use a method:

    &infix:<+>.variant(Complex, Complex);

The method approach has some other advantages, like the ability to add
another method:

    my $code = &infix:<+>.dispatch($a, $b);  # what code would we call
                                             # with $a and $b?

Or we could use square brackets, since square bracketing types just
selects a type, but doesn't do anything to it.  But especially because
this only applies to multimethods, I like the method approach the best.

Luke

Reply via email to