Seg, 2008-04-28 às 10:15 -0700, Jon Lang escreveu:
> Ah; that clears things up considerably.  If I understand you
> correctly, John is using '£' to mean "use Duck Typing here".  _That_,
> I can definitely see uses for.

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)

which is implementation specific, but as for what it's worth, might be
abasolutely anything that says true to that call, even if it's just a
reference to a pointer in a low-level binding of some library...

The point I'm trying to make is that Perl 6 already accepts anything
that "does" Point, even if it "isn't" a Point, that happens basically
because Perl 6 have polymorphic representation.

That actually means that you *never* can count on knowing how the
object is implemented (except for native types, of course). So there's
actually no need for the "like" idiom, because there's no "true isa" in
Perl 6.

In Perl 6 one object "isa" something as long as it says true to "isa"
something. The only exceptions are the native types, see
http://www.perlfoundation.org/perl6/index.cgi?smop_native_types for a
little longer reasoning on that.

daniel



Reply via email to