Modern languages have so many features that they must keep the grammar small in order to reduce the learning curve. I guarantee that the best state-of-the-art languages of the future will do the same. For this reason alone, Python is clearly better than Ruby or Perl.
— Clark Maurer, Comparing Python to Perl and Ruby
I almost hesitated to link this one, because Clark works on a text editor and has some idea of what it takes to provide syntax highlighting and language support. However, you know the rules of the Internet: if you say something silly, expect someone to call you on it (sadly, even if it's satire).
By the criterion in the quoted paragraph alone, bf is clearly better than even Scheme, but loses out to the Universal Turing Machine. Python can't even compare; its grammar is over a dozen lines long.
The assertion that keeping a grammar small reduces the learning curve of a language with lots of features baffles me. No matter how much syntax fetishists pound their fists on the table, call/cc
just isn't immediately obvious to novices simply because Scheme has uniform prefix syntax. The other assertion that Ruby is difficult to learn because yield
means something different than in other languages makes me think that Dylan should have more users than Lisp. (Ouch.)
chromatic's second rule of programming language syntax is You can always look up syntax in the manual.
Re:Huh?
hex on 2007-09-27T11:20:53
Dogbert's tech support: "While you hold, read the free novel we've enclosed. It's a Spanish story, about a guy named 'Manual'."
Re:It's true for authors of editors at least...
pudge on 2007-09-27T00:33:58
You're right, it is all about context, and even then, it is very subjective. Which is why we have so many languages with so many differences. We don't agree very much on the Best Way.
I read some of this article and man, it's got screwy logic. Like "variables are global by default" is bad. Why? There's no objective truth there. And if he doesn't like it, use strict and the problem goes away. BFD.
And then there was this gem:Yet he had no problem with this:${$arrayRef}[0]=4; #YUCK! Modify the callers array.So why didn't he just do this?:array[0]=4; #Modify the callers listProbably because he didn't know. Heck, don't even call it arrayRef. If you are calling $array, you already know it is an arrayref. Just do:$arrayRef->[0]=4; #Modify the callers arrayNow would he say "YUCK!"?$array->[0]=4; #Modify the callers array
As to "passing by reference" being "ugly," I don't see why. I see it as clear and logical. But whatever, if you don't like, then use all references to begin with. No big deal. But this from someone who complains about changing the "prefix."
And then he appears to think that print should actually MUNGE YOUR OUTPUT.
If he knew Perl, he could be perfectly happy, I imagine, with this, apart from parameter passing:I think it shows that he doesn't really understand Perl, and he is arguing largely from ignorance.use strict;
sub func { # You've got to be kidding parameter passing.
# Perl 6 intends to fix this.
my ($x,$array)=@_;
#$i=2; # This won't compile
++$x;
$array->[0]=4; # Modify the callers array.
#$newvar= 'abc'; # This won't compile
print $x,"\n";
return(1);
}
my $i=1;
my $array= [1, 2];
my $x=func(1,$array);
#print $newvar,"\n"; # This won't compile
print "i=$i\n"; # i is 2
$array->[1]=0;
print "$array->[0] $array->[1]\n"; # prints 4 0
Re:It's true for authors of editors at least...
Alias on 2007-09-27T01:07:58
> I think it shows that he doesn't really understand Perl, and he is arguing largely from ignorance.
Yup, pretty much.
I'd say there's really not any useful points to recover from that article, except what we already know about the relationship between grammar and tool quality.LADs and LASSes
mr_bean on 2007-09-27T02:25:17
That's an important insight, I think. I wouldn't have had such a good relationship with perl if I hadn't had one with my editor.
grammar: Language Acquisition Device
tools: Language Acquisition Support System
The assertion that keeping a grammar small reduces the learning curve of a language with lots of features baffles me.
It shouldn't baffle you. It's an old prejudice, and it needs to be examined in context.
It dates back to the bad old days, when computers were small, languages were simple and static, keyboards sucked, no one had good typing skills, and programmers had to use different languages periodically. Or, worse yet, they had to switch between this quirky extended version of a pre-standardized language and that quirky but differently extended version of the same pre-standardized language.
The hardest thing to do was to get code past the compiler. And most of the time, something would just slightly be amiss, and the compiler would spit back some form of a 'syntax error'. Whether it was a missing comma, a missing semicolon, a missing 'END' token, a misplaced identifier, a misunderstood identifier or whatever -- it was all just a mess of syntax errors.
We're past all that now. Today, the syntaxes come and go, and our highly evolved 21st Century Brains can hold more than one syntax at a time. Plus, the syntaxes all kinda melded into a zone of small variation (excepting bf, of course). And the hardest thing isn't getting code past the compiler, but learning the scope, capabilities, quirks and behaviors of the standard library, 3rd party libraries, and the dynamics of the runtime environment. Syntax is easy, and if you can't remember all of it, your IDE or code highlighter probably will.
All of which means, anyone who is still talking about syntax and big grammars being hard is still living in the 1970s and 1980s, laboring under these old prejudices, and really isn't worth engaging in a debate about modern programming.
Re:Old prejudices die hard
chromatic on 2007-09-27T06:01:09
All of which means, anyone who is still talking about syntax and big grammars being hard is still living in the 1970s and 1980s, laboring under these old prejudices, and really isn't worth engaging in a debate about modern programming.I get the feeling a fair few of the people who say these things have only used one or two languages in the Algol family and haven't ventured much outside the realm of procedural/OO programming. Maybe I'm lucky that my first programming language was C-64 BASIC and I switched between the Apple ][ and Atari 800s as well, with some rare dabbling in machine code. I even remember the first time I deciphered an APL program.
It really is a pity that people with such shallow experiences have such superficial reactions to different programming idioms. Polyglots have a real advantage. (Of course, even though I appreciate Haskell's strengths, I still think its syntax is a bummer.)
Re:Old prejudices die hard
ziggy on 2007-09-27T18:43:35
It really is a pity that people with such shallow experiences have such superficial reactions to different programming idioms.
It really is a pity that people with no understanding of foreign policy hold court on what their nation's military strategy should be.
It really is a pity that people with no background in either mathematics or economics have such shallow views on foreign trade.
This problem is not endemic to us. These people are idiots. There is no chance in changing their mind, or educating them by pointing out the latent prejudices in their arguments, or any other means for that matter. Just walk away.
Re:manual? no, seriously?
chromatic on 2007-09-27T17:57:34
Programming Ruby 1e is available online for free, and it's recent up to Ruby 1.6. Why would you want an installed version? You're not on an airplane! You're not on a bus! C'mon, old timer. Get on the trolley.
Re:manual? no, seriously?
rjbs on 2007-09-27T18:49:03
Yeah, and using an educational text instead of a manual is great, because it means you get to enjoy the pedagogy every time you just need to check what a colon does. Thanks!
Whatever, I don't ever program in Ruby, just Ruby-powered DSLs.Re:manual? no, seriously?
hummassa on 2007-09-28T11:18:55
You're not on an airplane! You're not on a bus! C'mon, old timer. Get on the trolley.But, if you _happen_ to be constantly on train/airplanes/busses, apt-get install rubybook will do the trick... for some of us;-)
Re:The Guy does not even know his *python*...
chromatic on 2007-09-28T17:01:09
The biggest problem I have with a new language is SEMANTICS, not syntax...Exactly. A programmer who continually focuses on the syntax of the language is like a writer who can't remember how to put together sentences. Don't expect great results.