in reply to Re: I think Perl ruined me as a programmer
in thread I think Perl ruined me as a programmer
Take your min function. Suppose I want to use it to find the first word in a list. Can I? No! I have to write another function for strings! And if I want to compare arrays in lexicographic order, I need another one! (That one gets nasty, particularly with arrays of arrays.)
Compare Ruby (or Python, or Haskell, or Smalltalk). There the exact equivalent min function would work on any data type that defined <. So it would work on integers, floating point, strings, arrays of things that are themselves comparable, and so on. But Perl can't do that! Why not? Because Perl has typed operators and untyped data. Those other languages have typed data and untyped operators. So in those languages it makes sense to "compare these things" with the most natural possible comparison. In Perl it doesn't.
Sure, Perl is much better than Java in this regard. But that is a deficiency which generics can help with. By contrast Perl's deficiency is not readily removable, it is inherent in Perl's notion of data that automatically casts itself to whatever it is asked to be. (A notion which does, of course, pay off in other conveniences.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: I think Perl ruined me as a programmer
by TimToady (Parson) on Nov 03, 2007 at 04:53 UTC | |
by tilly (Archbishop) on Nov 03, 2007 at 13:02 UTC | |
by TimToady (Parson) on Nov 03, 2007 at 15:40 UTC |