Slashdot Mirror


Is Perl Better Than a Randomly Generated Programming Language?

First time accepted submitter QuantumMist writes "Researchers from Southern Illinois University have published a paper comparing Perl to Quorum(PDF) (their own statistically informed programming language) and Randomo (a programming language whose syntax is partially randomly generated). From the paper: 'Perl users were unable to write programs more accurately than those using a language designed by chance.' Reactions have been enthusiastic, and the authors have responded."

59 of 538 comments (clear)

  1. Better? by Hognoxious · · Score: 5, Funny

    Better? How about we start with distinguishable?

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    1. Re:Better? by Chris+Burke · · Score: 5, Funny

      Indeed. This is the reason why the Obfuscated Perl Contest is run by the Department of Redundancy Department.

      --

      The enemies of Democracy are
    2. Re:Better? by Smallpond · · Score: 5, Informative

      Yet another ridiculous summary. The study wasn't which language was better, it was in which language can first-time users write a program more accurately. My guess is that Cobol would beat any of the three - it is designed from the ground up to be readable.

    3. Re:Better? by mwvdlee · · Score: 2

      COBOL is designed to be readable, but it's hardly writable.
      (roughly 10 years of experience developing COBOL code).

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    4. Re:Better? by Junta · · Score: 2

      Indeed. vim is impossible for a first-time user. That does not mean it is a terrible editor. Over-emphasizing day 1 productivity is a bad thing when most of your days will not be 'day 1'.

      --
      XML is like violence. If it doesn't solve the problem, use more.
    5. Re:Better? by sycodon · · Score: 2

      No one writes COBOL anymore.

      We just tweak it.

      --
      When Fascism comes to America, it will call itself Anti-Fascism, and tell you to give up your guns.
    6. Re:Better? by Cro+Magnon · · Score: 2

      As I understand it, there was only one original COBOL program ever written. Everyone else copied & modified it for their purpose.

      --
      Slow down, cowboy! It has been 4 hours since you last posted. You must wait another few hours.
  2. Trick question? by MrEricSir · · Score: 3, Funny

    I always thought Perl was a randomly generated programming language.

    --
    There's no -1 for "I don't get it."
    1. Re:Trick question? by PPH · · Score: 4, Funny

      Hence the name: Pathologically Eclectic Rubbish Lister.

      --
      Have gnu, will travel.
    2. Re:Trick question? by X0563511 · · Score: 3, Informative

      Hence the name: Pathologically Eclectic Rubbish Lister.

      Note for the ignorant... that REALLY IS what it stands for!

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  3. Perl Is way better by PerlJedi · · Score: 5, Informative

    I'd have to say PERL is better than a lot of purposefully crafted languages. Its syntax is very forgiving, and there are lots of ways to do most things. Those two components are likely the reason this study came to that conclusion. This in no way means that PERL is not a good language. It does mean that many people can write PERL badly, but many people speak English badly and that doesn't reflect poorly on the language. PERL is, IMO, and should always be: Easy to do, but impossible to do "perfectly". But then I'm not sure that anything can truely be done "perfectly". Things may be done poorly, well, very well, or nearly perfectly, but to claim perfection is to deny the possibility of improvement.

    1. Re:Perl Is way better by Tridus · · Score: 4, Insightful

      "Its syntax is very forgiving, and there are lots of ways to do most things"

      That's probably why it's so commonly known as a write-only language. "Forgiving syntax" in particular usually leads to someone sitting around later trying to figure out WTF is going on.

      It's possible to write bad unreadable code in anything, but it's just so much easier in Perl that I shudder anytime I get asked to look at someone elses Perl code. That has NEVER been a good experience.

      --
      -- "So they told me that using the download page to download something was not something they anticipated." - Bill Gates
    2. Re:Perl Is way better by mvar · · Score: 2

      I use perl for my daily tasks (scripts etc) at work and this "forgiving syntax" has been a time saver.. imho perl is (or should be) just an administrator's tool, nothing more. And yes, its true that reading someone else's code is usually a bad experience and you probably end up writing the program yourself from scratch

    3. Re:Perl Is way better by gold23 · · Score: 5, Insightful

      I would suggest that perhaps Perl is particularly effective in separating good from bad programmers. In other languages, restrictions allow bad programmers to write code that *looks* good.

      But if you see readable, understandable Perl code, you know you've got a keeper.

      --
      Trust not a man who's rich in flax / His morals may be sadly lax
    4. Re:Perl Is way better by h4rr4r · · Score: 2

      use strict;

      Learn it, live it, love it.

    5. Re:Perl Is way better by PCM2 · · Score: 2

      Again, this depends on the programmer who wrote the code, not the language.

      Sure, but all the Perl documentation I've ever seen (Camel Book, etc.) encourages Perl coders to concentrate on the result foremost, even at the expense of the process. Thinking about how to write well-structured code seems to be actively discouraged in the Perl community. Once it works, you're done.

      The Python community were among the first point this out: Sure, there may be "more than one way to do it," as the Perl hackers like to say, but there's probably one good way to do it. If you don't even bother to think about what way that might be, you're going to tend to produce crappy code.

      --
      Breakfast served all day!
    6. Re:Perl Is way better by grcumb · · Score: 3, Insightful

      "Its syntax is very forgiving, and there are lots of ways to do most things"

      That's probably why it's so commonly known as a write-only language. "Forgiving syntax" in particular usually leads to someone sitting around later trying to figure out WTF is going on.

      One could - quite validly - say the same about the English Language.

      Now, I'll grant programming and spoken/written languages don't overlap perfectly with one another. That's why languages like LISP have such elegance; what they're designed to express is something far more abstracted and formalised in nature. It's possible to conceive of a complex structure and accompanying set of behaviours and properties simply by scanning a screenful of LISP, but English is narrative in nature. You don't scan across; you scan from top to bottom.

      It's possible to write bad unreadable code in anything, but it's just so much easier in Perl that I shudder anytime I get asked to look at someone elses Perl code. That has NEVER been a good experience.

      Perl can be difficult to grok, but it can be elegant as well. I've experienced revulsion looking at Perl code before, but never so consistently as with ASP and PHP. These are languages (and I use that term loosely) that simply cannot be made pretty.

      In the right hands, Perl can be as elegant and expressive (and opaque, and efficient) as Shakespearean English. Argue however you like, the same is not true of many other languages. Python has clarity and simplicity. It's truly an engineer's language. LISP, as I've said, is beautiful in the same way architecture can be beautiful: taken as a whole, rather than a story. I didn't understand the appeal of Ruby until I learned that its inventor is Japanese. Then it all became clear. What seemed like awkward, nearly backward syntactical constructions suddenly made sense.

      In other words, horses for courses. But arguing that Perl is not readable in its very nature is like arguing that English in incomprehensible based entirely on watching Jersey Shore.

      --
      Crumb's Corollary: Never bring a knife to a bun fight.
    7. Re:Perl Is way better by arth1 · · Score: 2

      Since it's an acronym, PERL is acceptable too.

      Perl = name of language.
      perl = name of compiler / interpreter
      PERL = acronym for Practical Extension and Report Language

    8. Re:Perl Is way better by eriks · · Score: 5, Insightful

      This!

      Perl is a "beautiful" language -- in the same way some people talk about certain human languages (e.g. romance languages, Russian, or Sanskrit) being beautiful, as opposed to merely functional. Other people will disparage those same languages as being too this, or not enough that... the same kind of debate we see with programming languages, particularly with Perl, which is kind of interesting.

      And for some of those human languages, you'll also hear people lament how horribly some non-native speakers butcher them, perhaps because those non-native speakers are using them merely as a "functional" language, rather than grasping the full depth of expression that is possible.

      This analogy has at least some merit I think, since Perl is a language that was designed "linguistically" at least in some sense, in that it has the same kinds of patterns that natural languages have and is chock full of idioms and expressions, that some programmers (myself included) find not only useful from a functional perspective, but actually enhance the creative process that happens when one writes code. I think part of that is due to Larry Wall's now venerable "Programming Perl" -- which is one of the few truly valuable programming books that's also actually fun to read -- especially if you're one of those people that thinks at least a little like Larry, and enjoys a dry wit.

      Anyway, so yes, I totally agree, programmers that need "restrictions" in a scripting language to have their code be readable are definitely a certain "kind" of programmer. Not that they are better or worse programmers, they just don't embrace the TMTOWTDI philosophy, which is something that the society at-large doesn't generally embrace, so it's no surprise that there seem to be a lot of people that shit all over Perl.

      I've seen (in my own code and in others) truly beautiful and elegant Perl code that reads like a story, and also the "line noise" code people complain about. Which is really all about regular expressions. Some people really love 'em, perhaps a little too much. Though as has been pointed out probably a billion times, there's nothing wrong with one-off throwaway code that looks like line noise, but if you're building a giant system, then your code should be all pretty and commented and generally sociable.

      It's both unfortunate (and I still hope... a mixed-blessing) that Perl 6 has taken so long to come about. In that PHP went and pretty much took over it's niche as a web-development and "glue" language. Though the Perl community is still strong, if small, and I have no doubt that it will remain a living language for a long time to come, if for no other reason than the fact that CPAN is awesome, and there are zillions of lines of code written in Perl that a lot of people depend on every day, and that when Perl6 matures, I think it will enjoy a resurgence, within the Perl community, and perhaps much further, simply because of the simple and powerful philosophies that it encodes.

      Easy things should be easy and hard things possible.

    9. Re:Perl Is way better by savuporo · · Score: 2

      Comments are supposed to tell you what's going on.
      I certainly hope not. Whenever i see comments in C++ or Java code i'm thinking "why did you not write this to be more ovious way in the first place, wtf needs explanations here".
      There a few cases where code needs comments IMO, and class-level and function-level docs are perfectly OK. But comments within source are a sign of
      a) something incredibly clever being done
      b) sloppy design or poorly written code that needs explanation on whats going on
      In 99% of the cases, its the second option

      Good code is self documenting in everything that it does, at least in sane languages

      --
      http://validator.w3.org/check?uri=http%3A%2F%2Fwww.slashdot.org Errors found while checking this document as HTML5!
    10. Re:Perl Is way better by Required+Snark · · Score: 2, Insightful
      You are dangerous, incompetent and unprofessional. I sincerely hope that you never work on any system that could even remotely threaten anyone's well being, either physical, mental or economic. There is no such thing as self documenting code. That idea was disproved with COBOL. You have no idea what you are talking about.

      Despite some of the ill founded comments in this discussion, natural language is not comparable to computer language. Programming is closer to mathematics then human language. In the same way that mathematical expressions are always combined with text, code requires comments. No one expects to understand mathematics by just looking at equations, and no one should expect to understand code without comments.

      Human language is reflexive in a way that software is not. This means that understanding software requires information that cannot be expressed in code statements. In order to be comprehensible, particularly when multiple people are involved, comments are a necessity. If you don't understand this you should really be in another line of work.

      --
      Why is Snark Required?
    11. Re:Perl Is way better by Antisyzygy · · Score: 2

      Agreed. I am a PhD mathematics student and I can attest its extremely difficult to understand equations without context and written explanation. Im also a programmer (for my job) and I write my code to be very readable with proper formatting and self-explanatory variables/classes (as much as they can be), however even when I look at my OWN code from the distant past I need comments to sort out the macro-structure of it as well as to explain a complicated line quickly. If you don't remember what some class or function does, its easier to comment that line to briefly explain it rather than have to go look through everything and find it then logically deconstruct it to figure out what it does. Its just bad practice to not comment your code. The more comments the better, and also the more readable it is to other people that may have to use your code in the future. I have had too many times where I get code that takes twice as long to understand what it is doing just because the author didn't comment.

      --
      That brings me to an interesting point, / . is just "the ramblings of socially-inept, technology-literate news-mongers".
  4. Re:Next question by Halo1 · · Score: 5, Funny

    How does C++ fair?

    Farely average.

    --
    Donate free food here
  5. Re:Next question by Anonymous Coward · · Score: 2, Funny

    How does C++ fair? LOL

    #%@$&#@^UGSOWDYRO&F@#L(EGFGP*$TW

    This Script written in Perl computes the answer.

  6. Not so fast.... by Ardeaem · · Score: 4, Informative

    They claim that Perl is not significantly better than Randomo, but that's just due to the test they chose. Looking at their figure, Perl programmers outperformed Randomo programmers in 6/6 tasks (that is, their means were greater). Using a simple sign test on the differences between the means, the two tailed p value is about 0.03, and the one-tailed p value (I think we're justified here having having a directional hypothesis...) is about 0.015. Both of these numbers are less than 0.05; we are justified in saying that Perl programmers performed significantly better than Randomo programmers, in spite of what the paper says.

  7. What are they trying to prove? by medv4380 · · Score: 2

    Are they telling me that Quorum is better then a randomly generated language at teaching and that Perl makes bad programmers? This sounds more like someone setting up a study and trying to rig it so that their horse (quorum) gets taught in the class room. Personally I stick Perl in the same bucket as VB and most scripts. They may have their uses but new programmers need to be beaten with languages like C and C++ first. Otherwise they learn bad habits. Perl only starts getting good when you use strict so that it has been given permission to beat the programmer for any little mistake.

    1. Re:What are they trying to prove? by GuldKalle · · Score: 2

      First, a question: Why is it such a bad thing to use whitespace as syntax?

      Second, the act of indenting your code is not in itself a bad thing (when we talk "normal" languages like C), so why is it suddenly a bad habit when they pick it up in Python?

      --
      What?
  8. Re:Novices learning from whom...? by finnw · · Score: 5, Informative

    Yes it was Perl 4, which is one of the flaws in this study.

    --
    Is Betteridge's Law of Headlines Correct?
  9. Re:Quorum looks a lot like Pascal by h4rr4r · · Score: 4, Insightful

    Languages that consider whitespace need to die.

  10. Also... by Ardeaem · · Score: 5, Insightful
    They also say that

    While Perl has never had a particular reputation for clarity, the fact that our data shows that there is only a 55.2 % (1 - p) chance that Perl affords more accurate performance amongst novices than Randomo, a language that even we, as the designers, nd excruciatingly difcult to understand, was very surprising.

    This is a complete misunderstanding of what a p value means in statistical inference. The p value is not, and should not be interpreted as, the chance that "Perl affords more [or less] accurate performance." The p value is the chance, given that there is no difference, of obtaining a difference as large or larger. This is covered in first-year statistics.

    1. Re:Also... by zippthorne · · Score: 2

      If p is the chance, given no difference, of obtaining a result that is larger, what would you interpret (1-p) to mean?

      --
      Can you be Even More Awesome?!
  11. In a hundred years we will see this as brilliant.. by SirSpammenot · · Score: 2

    But for now... If I were a Samurai, I would not start newbies with a live sharp sword. And Modern Perl is so, so very sharp...

    I keep reading the full paper (+points for publishing the whole thing!) and have yet to hit upon the definition of the word "accurate" they are using to measure the results. Apparently that is contained inside their previous paper with no direct link. On page 3 though, Perl is described as "A well-known commercial programming language". Really? C# is a commercial language, Perl is an Open Source language with wide commercial adoption that has evolved or the years into several distinct beasts.

    --
    1 Dachshund + 1 Dachshunds = A Paradox.
  12. Re:Quorum looks a lot like Pascal by narcc · · Score: 3, Insightful

    Well said.

    If you want your code properly indented, just indent it. It's like the Python apologists are incapable of formatting their code properly unless the language forces its particular version of "properly" on you.

    Before the trolls fire back: In the case of code written by others, run it through a pretty-printer. Problem solved. Oh, as a bonus, you can use that same tool to format code the way you prefer, and switch it back to whatever style your company requires at the press of a button. Why is this a bad thing?

  13. Well written Perl by danbuter · · Score: 3, Interesting

    When Perl is well written, including indents and not jamming multiple lines all together on one line, it looks very similar to Python, but with a semicolon at the end at each line.

  14. If you give someone Lisp, by Latent+Heat · · Score: 2

    I was going to post a string of close parens as representing the termination of a Lisp program, but the comment moderation nanny would not let me do that. So much for trying to tell a geek joke around here.

  15. Re:Quorum looks a lot like Pascal by MoNsTeR · · Score: 5, Insightful

    If those punctuation marks (or keywords) make the code more readable, then they're not gratuitous are they?  I, for one, find brace-less languages fantastically hard to read, Python especially.

  16. Re:Novices learning from whom...? by Smallpond · · Score: 5, Informative

    "we did not train participants on what each line of syntax actually did in the computer programs. Instead, participants attempted to derive the meaning of the computer code on their own."

    They were not trained. They were just shown code samples with no explanation. The code samples had 1-letter variable names and no comments. The Perl sample uses $_[0} for getting the first sub argument instead of shift, and "for ($i = $a; $i = $b; $i++)" to do a for loop instead of "foreach $i ($a .. $b)", so it is deliberately obfuscated Perl.

  17. Re:Quorum looks a lot like Pascal by AJWM · · Score: 4, Interesting

    Fortran (at least, IV and earlier) totally ignored white space, even in the middle of an identifier. Of course, this led to problems like

    DO 10 I = 1.10

    meaning "assign the floating point number 1.10 to variable DO10I", when the programmer meant to type

    DO 10 I = 1,10

    meaning "loop from here to label 10 varying I from 1 to 10".

    An error something like this caused the Mariner II probe to Venus to go off course at launch and the Range Safety Officer hit the destruct.

    --
    -- Alastair
  18. Re:Quorum looks a lot like Pascal by DragonWriter · · Score: 2, Insightful

    Languages that consider whitespace need to die.

    Most languages consider whitespace. In most programming languages where both of the following are valid, they will have different semantics:

    1: foo bar
    2: foobar

    Quite a lot of languages even distinguish between different types of whitespace, e.g., C where the following two constructs are different, despite differing only in which particular kind of whitespace:

    1:
    foo(); //
    bar();

    2:
    foo(); // bar();

    Python may be unusual in which differences in whitespace it considers significant, but not in that it considers whitespace significant. People need to stop confusing the issue.

  19. Perl and language by knarf · · Score: 2

    Perl is a language, just like Dutch, Swedish, English, German and most of the others. In just about any language there is, to paraphrase a well-known Perl motto, more than one way to say something. That is in many ways a good thing, especially when it comes to using the language creatively as a novelist or poet or similar type of wordsmith does.

    It is true that this quality does tend to make Perl programs somewhat hard to grasp for the uninitiated in the programmers style of writing. That is another quality the Perl language shares with those other languages mentioned above - did you understand all of Finnegans Wake the first time you read it?

    In other words, Perl is a writers' language. It is not an editors' language. Once you get into the right mood, Perl flows like your native language does. Done right, this can lead to great things. It can also lead to the sort of notes you made when attending those lectures you did not care about in the first place, and did not understand in the second. Use Perl for things you care about, and it will provide you the means to express yourself in just the right way (for you).

    --
    --frank[at]unternet.org
  20. Re:Quorum looks a lot like Pascal by jd · · Score: 3, Funny

    Fortran is interesting, theologically - it considers God to be real unless declared integer.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  21. Re:Next question by jd · · Score: 3, Funny

    I dunno. Since it's a comment on Perl, starting with a # would seem to be entirely accurate according to the syntax.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  22. Re:Quorum looks a lot like Pascal by Chris+Burke · · Score: 4, Interesting

    If those punctuation marks (or keywords) make the code more readable, then they're not gratuitous are they? I, for one, find brace-less languages fantastically hard to read, Python especially.

    I LUUUUURV Python so much that if it was legal I would marry it, but I completely agree. Curly braces to denote block starts and stops make the code easier to read and manage. I should not have to wonder whether a function or block continues past the bottom of the current screen's worth of code when it ends with a few lines of whitespace because I have to know the indentation level of the next line of code to know if it's in a different block context than the last line of code on the current page. I also should never have to wonder if I re-indented code correctly when cut/pasting or adding/removing a level of block nesting.

    I don't care if Python wants to keep the indentation requirements. Forcing the code of awful programmers to be more readable in this way is a good thing. Forcing all code to be less readable in another way is a bad trade-off. Just add in the damn braces! Then I can use tools to auto-indent for additional readability.

    --

    The enemies of Democracy are
  23. Re:Quorum looks a lot like Pascal by rthille · · Score: 2

    I've always felt that version control systems should store syntax trees, but have never had the time to do the work to do that.

    --
    Awesome furniture, accessories and cabinetry in Santa Rosa, CA: http://humanity-home.com/
  24. Re:Novices learning from whom...? by chromatic · · Score: 3, Informative

    While calling functions with an ampersand may not have any obvious advantages...

    It in fact has three disadvantages: it bypasses any prototype coercions, it passes @_ unmodified by default, and it's unidiomatic.

    I'd argue that C-style loops are a good idea...

    All of these fencepost errors I've fixed argue otherwise.

  25. Re:Quorum looks a lot like Pascal by shutdown+-p+now · · Score: 4, Insightful

    Personally, I find that curly braces make code easier to read on top of perfect indentation. In truth, though, it's not so much the braces, as it is the nearly-empty lines of code that are spend to put those braces (note: this specifically applies to ANSI-style brace layout only, not K&R style). It creates a kind of a visual box, clearly delimited, with body of the block in it - more so than plain indentation does by itself.

    That said, I wouldn't call Python "fantastically hard to read", quite the opposite - it tends to be one of the easiest languages to read. Not because of indentation, but because its basic syntax is rather clean.

  26. Re:Quorum looks a lot like Pascal by shutdown+-p+now · · Score: 2

    No-one is saying that Python is good because it forces you to indent. Quite the opposite: all sane people indent their code anyway, whatever the language, so why not use that to indicate program structure?

  27. Re:Next question by shutdown+-p+now · · Score: 2

    Unfortunately, C++ remains the only language with a full-featured yet concise RAII, which is its main advantage when compared to C. And templates, while messy, are also extremely efficient in terms of generated code - more so than similar mechanism (generics etc) in pretty much any other language I know of.

  28. Re:code styles by leenks · · Score: 2

    Just enforce a formatter on commit. If the formatted code is any different from the original file, abort the commit. Git makes this kind of thing easy. It also means the repository is always in a sane state. A simple script can reformat all changed files trivially before a commit operation.

  29. Re:Next question by increment1 · · Score: 2, Informative

    The study cited has several biases in favor of the scripted languages that are acknowledge by the author in the references of your supplied link.

    Primarily:
    - The non-scripted languages (C, C++, Java) were tested under formal conditions in 1997 / 1998 (Java 1.1 I assume), the script programmers wrote their programs at home and self reported their times (and in most cases spent several days thinking about the problem before starting work, time which was not included).
    - The script programmers were told that the programmer effort and elegance of their solution was a criterion, the non-script programmers were only told that the program would be judged based on its correctness (accuracy).
    - The script programmers had immediate access to a hint (to resolve a misread requirement) which was only available to non-script programmers after they failed an acceptance test.
    - The non-script group would have a cost deducted from them each time their program failed an acceptance test, whereas the script group had access to the final acceptance test data.

    Overall, the comparison between the languages does not seem fair, or at least not the comparisons of the scripted and non-scripted languages.

  30. Re:Quorum looks a lot like Pascal by nschubach · · Score: 2

    Because not everyone uses the same indentation as everyone else. If indentation rules need to be worked out before starting a project, you're wasting more time than a language where indentation has no meaning.

    --
    Every time I start to have faith in humanity, I ruin it by driving to work between 7 and 8 am.
  31. Re:Quorum looks a lot like Pascal by lgw · · Score: 2

    Really, Python's problem is that both spaces and tabs are legal - if the language required one or the other, it would be fine, modulo subjective readibility arguments about braces.

    --
    Socialism: a lie told by totalitarians and believed by fools.
  32. Re:Quorum looks a lot like Pascal by gfody · · Score: 2

    Modern IDEs make it so easy to convert from one style to another I wish they would just make it a display option. Then each developer could read and write in the style they prefer.

    --

    bite my glorious golden ass.
  33. Re:Quorum looks a lot like Pascal by swalve · · Score: 2

    Why use four characters when one will do?

  34. Re:Quorum looks a lot like Pascal by Broolucks · · Score: 2

    That is only one of the two syntactic roles assigned to parentheses. The other is to disambiguate priority. For instance, you have to write (a + b) * c if you don't want it to mean add(a, mult(b, c)). But you see, combining multiple lines is very exactly this: priority disambiguation. Consider "if (cond) a; b". Priority is such that the statement is parsed like "(if (cond) a); (b)", because the if statement doesn't eat up semicolons. If you want it to mean "(if (cond) ((a); (b)))", then you could just put parentheses like this: "if (cond) (a; b)". Combining multiple lines into a single logical command precisely requires to override the fact that statements have higher priority than statement separators. This is perfectly consistent with what parentheses *already* do. Syntactically speaking, the if statement is to the semicolon what multiplication is to addition. Seriously.

    This being said, I consider that using parentheses both for priority disambiguation and for function calls is one of mathematical notation's biggest fuckups. For instance, a(b + c) can be either multiplication or a function call depending on context. That's just mind-bogglingly terrible. It's not nearly as bad in programming languages because straight up juxtaposition is often a syntax error, but nonetheless I would say that function calls should NOT use parentheses. They should use square or curly brackets, and parentheses should only serve to disambiguate priority, which includes grouping statements. You might see my point better then.

  35. Re:Novices learning from whom...? by Mjlner · · Score: 2

    A shift would have been more intuitive?

    No, but perhaps a "my ($a,$b,$c) = @_;" would have been. Since I'm a long-time Perl programmer, I can't really speak for the newbie. But the use of the numerous $_[n]-lines is probably unclear. In any case, it is considered bad code, since it is both hard to read and error prone.

    Using a foreach, instead of the C-style for loop, is certainly easier and MUCH closer to the implementation used in Quorum and Randomo. So that, at least, was very poorly thought-out. And Randomo? Is it really random? Or is it really Quorum with a bunch of substitutions made? Just look at the code samples.

    When I had a look at the paper, the first thing I noticed was the use of the ampersand sigil in a function call. This has been considered bad code in Perl since time immemmorial and really goes to show to things:
    * The researchers didn't know the first thing about contemporary Perl and didn't bother to find out, ie. do research.
    * The researchers did nothing to make the Perl code readable, which is paramount for newbies to any language.

    And worst of all, and this is really appalling, they are cherry-picking their methods. Just look at the table and the numbers, then read their analysis. And don't even get me started on the sample-size...

    --
    Lemon curry???
  36. Re:Novices learning from whom...? by MadKeithV · · Score: 2

    The Perl sample uses $_[0} for getting the first sub argument instead of shift, and "for ($i = $a; $i = $b; $i++)" to do a for loop instead of "foreach $i ($a .. $b)", so it is deliberately obfuscated Perl.

    As someone with a grand total sum of one hour of Perl experience about 10 years ago, that does not look like deliberately obfuscated Perl, but Perl written by a C programmer.
    I'm willing to bet I would understand this "obfuscated" code a lot better than your idea of non-obfuscated Perl code. That doesn't mean I think the "obfuscated" code is better - just that it's a better match for the way my mind has been twisted by the particular programming language I use most often.
    That's also why this study is somewhat interesting - it starts from people without any prior experience in programming, just your average human experience. And the language based on "intuitive" concepts (i.e. concepts from general human experience instead of programming-language specific concepts) did better. Is that surprising? Not very, except for providing a first insight that some concepts may in fact be more intuitive than others and thus more easy to learn. Does that mean in the long run these concepts will also be the most productive? I cannot say for sure, but I had a lot of fun trying to bend my mind around Lisp, and noticed sudden leaps in producivity when things "clicked", so my grand total of one anecdote tends to make be believe that some non-intuitive concepts may be a lot more productive than the intuitive concepts.

  37. Re:Quorum looks a lot like Pascal by Unequivocal · · Score: 2

    My main objection to semantic indent can be summarized in this psuedo code example:

    class fubu
        function foo(bar)
            start function
            more code
            all's well
    console.log("debug message")
            more real code //end foo //end fubu

    Having that debug console statement out of band with the rest of the functional indents makes it easy to notice when scanning code. Now you might say one should never debug that way, which is fine, but I do sometimes (and know others who do), and so I don't like semantic ident languages b/c they prevent me from doing something in a way that is helpful/useful in my workstream. Sure I can solve this with search/replace etc, but I like the visual cue sometimes.

    It's a minor point but at least for me significant.

  38. Re:Quorum looks a lot like Pascal by amirulbahr · · Score: 2

    Oh the fucking irony of it. I was trying to post the following using pre and code tags without success and just ended proving your point:

    Sure. Because

    def function(): if condition: while ok: do_something() end while end if end def Is much more readable than: def function(): if condition: while ok: do_something()