Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Ironically I consider that one of Perl's weak points compared to other languages.

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.)


In reply to Re^2: I think Perl ruined me as a programmer by tilly
in thread I think Perl ruined me as a programmer by Petras

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-19 12:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found