Smylers writes:
> Joe Gottman writes:
> 
> >       sort {$_.key} (1=> 'a', 10 => 'b', 2 =>'c');
> > 
> > There is nothing in the signature of the key-extractor to suggest that
> > all the keys are numbers, but as it turns out they all are.
> 
> Are they?  I'd been presuming that pair keys would always be strings (as
> for hashes in Perl 5), and that the C<< => >> operator would
> automatically quote a preceding word, stringifying it (as in Perl 5).
> So the keys above are strings, albeit ones composed only of digits.
> 
> Of course that doesn't actually help with your question, since there are
> other data structures of which the same could be asked.

I think you're forgetting what language you're talking about.  Those are
numbers.  After this statement:

    $x = '345';

C<$x> is a number.  I should hope it would be treated as one during
multimethod dispatch.

However, I'm not saying this with authority.  I'm just extrapolating.
If it's not correct, I'd appreciate that someone who knows correct me.

Luke

Reply via email to