in reply to Re^3: I think Perl ruined me as a programmer
in thread I think Perl ruined me as a programmer
And, to tell the truth, in Perl 5 you can already use overload to define a comparison function and then use a fairly generic min function. Of course people don't actually use this much in practice. For many good reasons. Most people haven't learned what they can do with overload. Also it is a fair amount of work (Perl 5 doesn't have multiple dispatch to help). And using overload like this in shared Perl code violates the principle of not surprising your maintenance programmer. And finally because for most programs it is more convenient to use default data types.
That said, the first bug I found in Ruby was that if you defined a subclass of String that is exactly like a String but it compares in reverse, the built-in sort method from Comparable will ignore your comparison and use the normal string comparison. I was told that this bug is due to a deliberate optimization. I just tested it. The bug is still there. :-(
So even having a clean design doesn't help you if you break your own design for performance reasons.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: I think Perl ruined me as a programmer
by TimToady (Parson) on Nov 03, 2007 at 15:40 UTC |