Re: OT: Programming Languages (Was: Spell Checking for Non European Languages, and for Conlangs)
From: | Mark J. Reed <markjreed@...> |
Date: | Tuesday, March 30, 2004, 23:50 |
On Wed, Mar 31, 2004 at 12:38:13AM +0200, Henrik Theiling wrote:
> Hi!
>
> Chris Bates <christopher.bates@...> writes:
> > their code it hinders readability a lot. I love the way python deals
> > with blocks... indentation only...
>
> Oh, yes. It's my point of view, too. Modern languages *must* have
> use indentation. It removes many traps.
It also removes any ability to sanity-check. With keyword block
boundaries, it's possible to write plugins for your favorite editor that
automatically verify that the indentation and keywords agree. When the
indentation *is* the structure, there's nothing to check against. It
also removes the ability to use indentation to make particular lines of
code stand out, a very useful device for temporary debugging statements.
etc.
Python wasn't the first language to use indentation for structure, btw.
It had popped up here and there before; in the 80s there was a language
called Occam, designed for programming transputers, which was far more
restrictive than Python in that it mandated how many spaces each level
must be indented. (Occam was one of many "It's the end of the
programming world as we know it!" languages, btw. This or that technology
(multi-threading at a fundamental level in the case of Occam)
was supposed to render the previous languages useless and require
a whole new paradigm. Of course this never turned out to be the case,
and people kept right on using the same old programming languages.)
Python is an okay language, but its advocates tend to have this idea
that it's the end-all be-all and that other languages - especially Perl
- are Wrong. From what I've read, in this matter they are taking their
cue from the language's inventor, Guido van Rossum, who is a little
too convinced that his way is The One True Way. This attitude stands in
stark contrast to that of, for example, Larry Wall (who created Perl),
John Ousterhout (who created TCL), or Yukihiro Matsumoto (who created
Ruby). Ruby is, incidentally my current favorite language of the type;
it's completely object-oriented (in the way that Python advocates often
claim Python is, but it's really not). It shamelessly borrows many of
the shortcut features that make it possible to write quick one-liners to
get a one-off job done in Perl, but recasts them such that they don't
break the O-O design. It has a generalized iteration model that is just
gorgeous in its elegance (a feature borrowed from Smalltalk).
I think it's well worth a look for Python programmers.
> > I don't think that would work for lisp though.
Keep in mind that the syntax of Lisp was not originally supposed to be
the human-exposed syntax, but an intermediate representation hidden by
the development tools. It's just that the team never came up with
a satisfactory "top-level" syntax, and while they were trying everyone
was learning to program using the S-expressions and eventually they
just left the language at that.
Lisp has a certain elegance to it, but it's not particularly suited to
prettification by indentation. There are many different styles which
all work to some degree or another, but it's just now how the language
is built. This shows up in the sheer variety of styles used; it's one
thing when people disagree over whether to put opening curly braces on
the same line as the keyword or the next one, but comparatively, the various
formats used for e.g. let and cond statements in Lisp are wildly different.
C++ is popular for many reasons. The two biggest ones are that it's
built in C, which is a language many people learned early, and that it
is still the primary vehicle for building native executables for the
most popular platform in the world, Microsoft Windows on Intel hardware.
There's C++ development on Linux/UNIX and Macintoshes, of course, but
plain C is still more prevalent there, due to the fact that the
tradition of development on those platforms predates C++ as well as the
fact that the OS interface is C-like at a fundamental level and must be
wrapped for access via C++, whereas the Windows architecture is
fundamentally object-oriented in design and fits more naturally into a
C++ model.
I'm also professional programmer. Most of the work I get paid for is in
Java, but I also do a significant amount of work at the "glue level" in
Perl and shell script. When I program a tool for my personal use, or
just something for fun, I use Ruby, except in environments that mandate
one language or another (e.g. gdesklets have to be written in Python).
All the dynamic stuff on my website, including the "render this text in
Okaikiar's writing system" page, is written in Ruby.
-Mark
Replies