Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: disadvantages of perl

by ELISHEVA (Prior)
on Jul 03, 2009 at 14:02 UTC ( #777056=note: print w/ replies, xml ) Need Help??


in reply to Re: disadvantages of perl
in thread disadvantages of perl

You seem to be viewing (...) as a data structure. That isn't at all unreasonable, but it is not the only meaning that we commonly give to (...). Perl's definition of (...) is drawn from another part of life: math. A better mental model would be the parenthesis in math statement: (3+4)*(6+10). It is simply a way of grouping things to indicate the order in which you want them processed.

Merely being an ordered collection doesn't determine how we'll use it. There are many different things one can do with groupings: nest them, concatenate them, visit their members one by one. In Perl which action you want to take on the grouping depends entirely on context. For example, when you use it in a for loop, the for loop processes the elements in order (just as you asked). And when you assign it to an array, Perl adds each element to the array in order, just as you asked. Nesting parenthesis doesn't change the treatment any more than does ((3+4))*((6+10)). The elements still get added in the order you requested.

I had little trouble grasping Perl's approach to parenthesis because my interest in mathematics and my interest in programming are closely related. Perl's syntax was natural for me. But I fully appreciate that others have come to programming from different directions than I. They are used to giving symbols other meanings than I give them.

It all comes back to the the vagaries of DWIM (Do What I Mean). As tweetiepooh has pointed out a language's strengths are also its weaknesses. DWIM, or as Larry Wall calls it "The Principle of Least Surprise", is rather subjective:

... The question is, whose surprise are you pessimizing? Experts are surprised by different things than beginners. People who are trying to grow small programs into large programs are surprised by different things than people who design their programs large to begin with.

For instance, I think it's a violation of the Beginner's Principle of Least Surprise to make everything an object. To a beginner, a number is just a number. A string is a string. They may well be objects as far as the computer is concerned, and it's even fine for experts to treat them as objects. But premature OO is a speed bump in the novice's onramp.

Interview with Larry Wall, Slashdot, Sept, 2002

In a language where DWIM rules, we need to be very sensitive to the fact that not all of us are thinking the same thing when we get to the word "mean". If you are teaching Perl or helping an organization develop Perl skills it is very important to be sensitive to this issue or else you will end up with confused frustrated programmers for whom Perl definitely does not do what they mean.

Best, beth


Comment on Re^2: disadvantages of perl
Select or Download Code
Re^3: disadvantages of perl
by LanX (Canon) on Jul 03, 2009 at 15:02 UTC
    Hi Beth

    The OP was asking for disadvantages of Perl, and I was giving him a common view. An easy thing is only complicated to achieve, which violates a mantra of Perl.

    In fact this criticism is so widespread that Larry already changed this design in Perl 6 (almost a decade ago): @ and % default to references and the comma operator is changed.

    IMHO that will (sadly) also be the biggest source of confusion for migrating to Perl6.

    To be clear: I like flattened list, just shouldn't be the default.

    Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://777056]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2014-12-18 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (47 votes), past polls