Thomas Sandlaà writes:
> Larry Wall wrote:
> >One can always mixin a "does LinearInterpolation" at run time in the
> >body of the sub to get the effect of a directive, so I think the most
> >useful thing is to treat roles in signatures as constraints where
> >they can be used to select for MMD.
> 
> Further questions concerning MMD:
> 
> 1) How are the classes of
>    a) the container
>    b) the value
>    used in dispatch? Note that 'Array of Num' in other languages
>    is more like a parameter on the template/generic: Array[Int].
>    Does it hold for Perl 6 in general that the 'of' is syntactic
>    sugar for (container) class specialisation? E.g. could Damian's
>    example of Source[Perl] be written as 'Source of Perl'?

Always.

>    Should the programmer get the chance to define if the type
>    parameter is either covariant or contravariant like the
>    extends/super in Java5 generics?

The words 'covariant' and 'contravariant' in this context seem like
voodoo math.  Please explain what you mean.

> 2) how are the where clauses used in MMD relative to roles and classes?

The type:

    Foo where {.meth}

Is a new type, which is a subtype of Foo.  That is, values of this type
are always Foos, but you may not be able to change them and keep this
property.

> 3) I guess the distance function is not specified yet, right? 

It was specified as simple manhattan.  I've been arguing for the past
year to get this changed (to 'pure', where there is no distance
function; two methods, which are both viable, where one's matching does
not imply the other's matching, are ambiguous).

>    Is it at least symmetric, so that it avoids the surprises that CLOS
>    has in store with its linearisations?

Yes, that's a high priority.  My latest proposal has yet to incorporate
that (but I believe it can be done).

> The multiple inheritance resolution is also relying on user
> intervention and not calculating a class precidence list as Dylan
> does. Symmetic means the following:
> 
>    with
> 
>    class Base {...}
>    class Left is Base {...}
>    class Right is Base {...}
> 
>    there are at most three binary multis allowed
> 
>    multi sub foo ( Base $x, Base $y ) {...}
>    multi sub foo ( Left $x, Left $y ) {...}
>    multi sub foo ( Right $x, Right $y ) {...}

That's not true.  I don't believe it would be an error to specify
all nine combinations.

Luke

Reply via email to