Jonathan Worthington wrote:
Yup. To be able to implement Perl 6's cmp as an MMD method on the junction, the ability to return a PMC as well as just a -1, 0 or 1 would be handy. Otherwise we just special case the implementation of the <=> and cmp operators to get junctions to thread through them. As you say, it would be useful for other languages that want to hand back an undefined value or something too. So perhaps a general mechanism is a good thing.

say $allison.thoughts; # por favor :-)

Perl 6 junctions are special constructs, with special kinds of return values. The Perl 6 operators will appropriately handle them, but low-level Parrot operations won't always. There are plenty of cases where HLL behavior is provided as HLL operators or functions made up of a series of Parrot operations rather than a single low-level Parrot operation, so this isn't any particular disadvantage for junctions.

(I'm fine with splitting out the comparison operators from cmp at some point, if we have a significant case other than junctions that it makes sense for. We don't currently.)

Allison

Reply via email to