4 ms·
Sorry that you don't like the "trolling". At worst, I am venting, though I am trying to make a point. The reality is that I am annoyed at having to deal with
by Goladus 17y ago
Sorry that you don't like the "trolling". At worst, I am venting, though I am trying to make a point.
The reality is that I am annoyed at having to deal with perl (actually am using DBI.pm; written by the guy who created the original slideshow) and am annoyed to read him "BUSTING!" a Perl readability myth without even understanding why Perl is hard to read in the first place.
You could have written the Perl code very similar to the Lua.
No, in fact, you can't. You can't use parameter lists in perl. You can't use variables without context.
And even where you can, this particular example which I just pulled up completely randomly wasn't written like lua. Which is what life is like when you are surrounded by perl code and are not a perl expert. Here's real code I was annoyed to have to read:
ABC::Myclass->find_or_create({thing => $thing->itm, otherthing => $x->itm});
Double-colon, hyphen-arrow, equals-arrow, variables with context specifiers, curly braces, and parentheses all for a simple library call. Curly braces normally mean a block of code, but here it means we're defining a hash. Double-colon and the dereferencing symbol mean different things, but I don't really have to care about that, it's just visually distracting. With python syntax it might look like this:
ABC.Myclass.find_or_create(dict(thing=thing.itm, otherthing=x.itm))
If you don't remember what dict() does you can look it up. Alternately:
ABC.Myclass.find_or_create({'thing' : thing.itm, 'otherthing': x.itm})
Note that in Python, curly braces are the standard way of defining a dictionary literal and are not used for anything else, as one can determine by searching for '{' in Python's context-free grammar: http://www.python.org/doc/2.5.2/ref/grammar.txt http://www.python.org/doc/2.5.2/ref/grammar.txt.
To determine that those curly braces in the perl example defined a hash, you have to root around in the docs looking for curly braces until you stumble on something that discusses hashes rather than code blocks.
All that is anyway dwarfed by the language specific libraries you use, as soon as you do something interesting.
I would agree that by the time you are neck-deep in a gigantic perl project then all that trivia will come second-nature. I have never done a gigantic project in perl. I have read lots of code various languages, though. Perl and C are the only ones where the language itself gets in the way, and C is really not that bad. (C++ is so bad that I'm not claiming to have ever successfully understood C++ code for a significant program)
- berntb 17y ago>>without even understanding why Perl is hard to read in the first place. You are talking about Bunce there.. he is smart (and pedagogically talented) enough to know what he is talking about, more than amateurs like us. :-) >> Which is what life is like when you are surrounded by perl code and are not a perl expert. Hmmm... you wrote "using perl longer than any other major language except C"? At the end, you wrote that you mostly read code... you're not really a full time programmer, but browse code for different languages? Again -- you're out of luck with most "real" environments, since you need the libraries. TCL is really optimized to be trivially easy... >> You can't use parameter lists in perl. You can't use variables without context. There are misfeatures in all languages. Without checking, you can find solutions for most every Perl problem on CPAN. If you go there, check Moose. Also check Enlightened Perl/Modern Perl on the web. If you are only going to read without writing, then you will probably not start enjoying Perl. If you use it for real, it is fun and has a really good community. Most of '::', '->' etc exist in other languages. I already discussed that. For another example, Python's ability to keep {} for one thing really kneecaps the possibility to do one-liners with the same syntax... :-)
- Goladus 17y agoYou are talking about Bunce there.. he is smart (and pedagogically talented) enough to know what he is talking about, more than amateurs like us. :-) It's not an uncommon problem for really smart people to have mistaken assumptions about what makes things hard.
- berntb 17y agoI'll expand on that. As you yourself has noted, you don't write enough to really know the language. Tim Bunce talks about what goes for real users of the language. Also, he is quite central in the community and certainly knows more about problems with education and teaching than either of us.
- jrockway 17y agoNo, in fact, you can't. You can't use parameter lists in perl. You can't use variables without context. This statement is meaningless. I have no idea what you're talking about. Try this: function( args => 'go here' ) And anyway, what exactly is the difference between your JavaScript (Lua? Python?) example and your Perl example? ABC::Myclass->find_or_create({thing => $thing->itm, otherthing => $x->itm}); ABC.Myclass.find_or_create({'thing' : thing.itm, 'otherthing': x.itm}) Other than "Myclass" being a field of ABC in your example, I don't see any difference at all. Your argument really makes no sense. I suggest you just say "I hate Perl" and stop trying to justify it.