Why insisting on semicolons?

by Adriano Ferreira

These days, the perl6-language@perl.org mailing list is haunted by some passionate discussions, spawning long (often too long) threads. Just yesterday, someone posted yet another "Why Perl 6 has not such and such features" message which sparked a lot of discussion. After a while, someone detached one of the points of the original message and asked why Perl 6 still goes with explicit line termination with the semicolon. And then came an answer by Larry Wall (and they are always worth reading).

These sorts of things are almost never for a single reason. Some of
it is my prejudice against dangling syntax, and perhaps prejudice
against anything resembling Fortran. Some of it is not wanting to
distinguish different kinds of whitespace any more than we already do.
Some of it is simplicity of parsing, both for the human reader as
well as for the computer. I think if I had to pick one reason,
though, it's that it allows the parser to understand the intent of
the writer much better and hence give more useful diagnostics when
something seems to be going wrong. Much more than other languages,
Perl depends on the prohibition against two terms in a row as a kind
of "self-clocking" mechanism to disambiguate programmer intent, and
not requiring a semicolon between the final term of one statement
and the first term of the next statement would tend to weaken that,
especially when the term starts with a prefix operator that could be
mistaken for an infix.


8 Comments

Tom
2007-05-14 23:45:40
It is always a bit bizarre when people use Google Trends to compare languages, since it is just counting the occurrences of words in news items. Like that has anything to do with languages.


And as far as comparing the sexiness Python's syntax to Perl, I don't know why the Python people haven't realized that Python died. Ruby killed Python. All of the bandwagon followers that left Perl, for Python, have now left Python for Ruby. Ruby capped off Python's growth. All of the cool kids are doing Ruby now.


At Perl still has its base of "getting things" done developers, who are still getting things done. And this core is bigger than Python. But Python will never have a chance to convert more of the bandwagon users to actual core developers.


What's next? Maybe erlang, or maybe Haskell. Functional languages are a bit hard sell, as they are harder for the bandwagon developers to pick up fast. But soon another bandwagon will come roaring through, and strip off all of Ruby's developers. Hopefully, they will have a solid base by then, rather than legions of bandwagon developers leaching off Ruby's cool factor.

Adriano Ferreira
2007-05-15 04:49:52
Tom: To say that Python is dead and that people should move along is pure prejudice. I am used to that as a Perl aficionado. But as long as there are Python programmers who enjoy writing Python code and while they feel it enables them to get their job done, the language is here to stay. (That same cantilena is valid for all programming languages.) The features that make Python, Ruby, and Perl great languages are not accidents. Each one of these can fit the way some people think about doing software, either by training or by heart. Some will not appreciate the style of other languages, but they don't need to be concerned about this while there is development activity to guarantee the actuality of their favourite tool and the language is good enough to do what they need to. And these conditions are thoroughly fulfilled by Python, Ruby or Perl.
Simon Hibbs
2007-05-15 10:17:28
Talk about detatching points from the orriginal massage!


I couldn't care less about semi-colons. It's just as trivial as complaining/raving about begin-end, braces or indentation for code blocks. Having used all three styles, I honestly have no preference now.

George Jempty
2007-05-15 18:26:00
Tom: Ruby killed Python? Actually Ruby is the "next Perl": so many freaking ways to do things that maintenance will be a complete nightmare.
Tom
2007-05-15 19:44:22
I guess to clarify: many, many blogs and articles about programming aren't actually written by programmers, but rather by wannabes and posers. Plus, a lot of hobby programmers, that just want to do follow the latest fad. This crowd has moved from Python to Ruby. Probably good riddance too.


When it really comes down to it, Perl, Python and Ruby are really just the same. They are OOish, dynamicish, imperative languages.


The problem for Python is, that new users will glom onto Ruby. This isn't prejudice, but fact. A new user that today has not used Perl, Python, or Ruby before, is going to pick Ruby. So Python is not going to grow anymore.


With a stagnant user base, hard core Python programmers will have less incentive to develop the CPython VM (ie. GIL). Microsoft is actively trying to destroy the community by dividing it with IronPython (which is basically a fork), and lots of developers are drinking that cool-aid already.


So Python is screwed. It really deserved better.

Aristotle Pagaltzis
2007-05-17 20:00:38

Mozilla is leaning towards Python.


Adoption of Python at Google is growing.


Heck, the OLPC project picked Python.


Ruby is getting all the press, but it seems that it’s Python that people are really picking up. I have no idea why this is, and as a Perl oldtimer, I don’t care.

Simon Hibbs
2007-05-18 13:47:46
Ruby does have a lot of good press right now, and the bookscan data shows it's book market is bigger than that for Python and growing faster, but it's largely a web language now.


Python is being used for system utilities scripting in many Linux distros, The OLPC project has raised it's profile here as well, there's even a Linux startup system replacement written in Python. There's nothing in the Ruby world that come close to wxPython, PyGame, Numpy, Matplotlib, IPython and many others.


They have different niches. Maybe Ruby's niche is bigger than Python's, but it's also more restricted in many ways. The main competitor for both of them is Perl, but even then competition is good. All the Python projects out there aren't goign away any time soon, Python book sales and adoption rates are still growing strongly.

Chris
2007-12-26 11:19:35
"Simplicity of parsing"? I guess Larry Wall's never heard of Python. Thousands of programmers get by, quite productively even, not having to waste time telling the interpreter where the line breaks are. Computers are dumb, but they're not that dumb.


All his remarks boil down to is a combination of laziness and old-man-set-in-his-way syndrome. No language is perfect, but I prefer to not waste my time typing things a program can easily figure out on its own.