[Pdx-pm] Perl 6 Docs and Differences
pagaltzis at gmx.de
Sat Oct 4 00:06:03 PDT 2008
* Erik Hollensbe <erik at hollensbe.org> [2008-10-04 00:30]:
> It seems like ~~ is a more primitive ocaml match/ruby case,
> where there is the concept of "match equality" (I'm thinking of
> the file tests and regexes particularly) that may be different
> from standard equality. Is that correct?
Based on a quick reading up on `match` in Ocaml, yes. I wouldn’t
call it primitive, though. I’m pretty sure a 1:1 implementation
of `match` will be possible in Perl 6 in user code, although I
don’t think it will be amenable to compile-time guarantees in the
same way. In that view, `~~` is just a convenient predefined
`match` expression that you use in common cases so you don’t have
to repeat all the time how you want the match to work.
> Does ~~ provide a direct syntax for multiple possible matches,
> or is that expected to be provided by the boolean operators,
> e.g., to test if a file is a directory or a file:
> $fn ~~ :f | :d # I doubt this is right but I hope this gets the point across
Actually, that is exactly right. The multiple-match syntax is
courtesy of junctions, though, not a feature of smart match
itself, and is available to other operations as well.
> Also, unless I'm missing something, the whole concept of soft
> references seems unaddressed. Are these disappearing entirely?
> While 99% of the time they are something to avoid, the 1% of
> the time they're handy... they're really handy.
I think the idea is that any time soft references were the best
way to do something in Perl 5, you’d use the meta-object protocol
in Perl 6.
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Pdx-pm-list