Hmm, I'm not seeing the message from Daniel, just this reply.
I like the idea of having a class method primitive to provide some
functionality. But type matching is more complex, as you can list
multiple types juxtaposed.
sub foo (A B £ C ::T $param)
and the actual match means does A, does B, and like C must all pass.
Also, note that ^like Point does more than just structure checking: it
doesn't check against Point as it exists, but what Point would become
(virtual type redefinitions) if it were declared as a direct base class,
and also doesn't mean Point[defaultargument] but deduced generic
arguments to Point-as-a-base-class that would work.
--John
TSa Thomas.Sandlass-at-barco.com |Perl 6| wrote:
HaloO,
Daniel Ruoso wrote:
hrmm... I might just be overlooking something... but...
sub foo (Point $p) {...}
means...
$signature ~~ $capture
means...
Point $p := $capture[0]
means...
$capture[0] ~~ Point
means...
$capture[0].^does(Point)
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
sub foo (Point $p) {...}
to mean
$capture[0].^like(Point)
which does a *structural* analysis.
Regards, TSa.