Uri Guttman writes: > >>>>> "LP" == Luke Palmer <[EMAIL PROTECTED]> writes: > > LP> Uri Guttman writes: > >> because that would be the default comparison and the extracted key value > >> would be stringified unless some other marker is used. most sorts are on > >> strings so this would be a useful huffman and removal of a redundancy. > > LP> While I like where most of this is going, I beg to differ on this point. > LP> I end up sorting numbers more often then strings, except when I'm > LP> sorting the keys of a hash. I'm always annoyed in my one liners when I > LP> have to write out: > > LP> sort { $a <=> $b } ... > > LP> And I'd be thrilled if it were as easy as: > > LP> sort { +$_ } ... > > oh, i don't want to see <=> anywhere in sort code. i don't mind + or int > as markers for that. you seem to actually be agreeing with me that > strings are the default key type and + is needed for a numeric sort. but > do you do integer or float sorts? and as i said, i don't like the > asymmetry of int vs +.
Usually integer. But specifying integer is usually an optimization guideline, whereas there is a much greater semantic difference between sorting strings and floats. C<int> deserves to be longer as just an optimization guideline. And yes, I agree that string should be default. Luke