Ter, 2008-04-29 às 09:28 +0200, TSa escreveu:
> The thing is the .^does  traverses the meta information
> to find the *named* concept Point. The FoxPoint in John's
> example doesn't have that and thus nominally fails the
> Point test. The idea is now to also have

.^does *might* traverse the information as well as simply return true if
the object says so.

The point here is whom to delegate the association between FoxPoint and

If we are to define an operator to declare that some arbitrary object
conforms to some API, I would think the following as saner...

sub foo(Point $p) {...};
´╗┐FoxPoint $fp = ...;
$fp realises Point;

This way, the dispatching mechanism is still the same (and still typed),
but the object now also answers true to .^does(Point).

Which means that the typed code remains typed and the feature is
implemented as a trait that can be used to any object, thus leaving the
fragile type inference to the code calling the method and not to the
method that wants a stronger typing...


Reply via email to