>>>>> "LW" == Larry Wall <la...@wall.org> writes:
>>> infix:<cmp> does numeric comparison if both operands are numbers, and >>> string comparison otherwise. LW> That is a bit of an oversimplification. LW> Any type may define infix:<cmp> however it likes for two arguments of LW> its own type. It may also define multis with other types that define LW> desirable coercions. The infix:<cmp>:(Any,Any) routine is what would LW> be providing the default string coercion, so it would succeed for LW> any two different types that match Any and have string coercions. LW> Outside of Any are the Object and Junction types; I suppose cmp can LW> thread on junctions, but trying to sort junctions might well result LW> in aberrant behavior, especially if we choose a sort algorithm that LW> coredumps on circular ordering relations. :) this means cmp still does a string compare as long as it can coerce its args to strings. this means the shorter sort ideas being bandied about still have a major weakness - specifying the sort comparison. you can default to string like p5 sort which is fine. but how do you pass in <=>? or handle multiple keys with different comparison ops? this is why damian and i agree that a key description style works best for a sorter. the short versions i have seen are useful for string sorts of a single key. there are plenty of uses for that and those would be a good short cut. but there still needs to be a full sort signature of the kind damian proposed and we have both built in different modules. there is plenty to steal from there so don't go reinventing this wheel just yet. :) thanx, uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Free Perl Training --- http://perlhunter.com/college.html --------- --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------