Larry Wall wrote:
> On Thu, Dec 11, 2008 at 02:24:54PM +0100, TSa wrote:
>> HaloO,
>> Carl Mäsak wrote:
>>> Pugs and Elf currently numify a Pair object to 2, and Rakudo currently
>>> dies of despair.
>>> My guess is that the semantics of Pugs and Elf falls out naturally
>>> form a pair being treated as a list of two elements, or something. The
>>> question still deserves to be raised whether always-2 is a good
>>> semantics, or whether one would prefer some other default.
>> My idea is to let a pair numify to whatever the value numifies to.
>> Same thing with stringification. In general I think that a pair should
>> hide its key as far as possible if used as non-pair.
> This makes sense to me, but I'd like to see any use cases to the
> contrary, if anyone can think of one.

The counter example is if you want to print a pair:

.say for %hash.pairs.sort: { .value };

In that case it would be nice to have the key appear in the stringification.

I haven't found a counter example for the conversion to Num though.


Reply via email to