[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scheme acceptance [no flames]



Leo Razoumov wrote:
> Gentlemen,
> I spent last weekend learning Python just for the sake of it. There is so much
> hype around Python these days, so I decided to see it for myself.
> In short it looks as a "poor man's Scheme" with some nice syntax cover.

And a lot of free software community hype. (not that the free software
community is bad, but we do tend to pick favorites :)

> Python syntax and semantics rules are convenient and emphasize code readability,
> even though syntax is rather unconventional. I cannot think of any other
> language except for Fortran-IV that is white space sensitive.
> I am not going to provide language comparisons here, enough to say that in
> comp.lang.python there are lots of discussions on adding Scheme features to
> Python:
>   * Lexical scoping (for real)
>   * Proper tail-recursion (project is called "Stackless  Python")
>   * Continuations

Cool! If they do it right, Python might further its reputation as a good
language for beginners. There's quite a movement to teach Python as an
introductory programming language. Better than Visual Basic, in any case
(I've heard that they're using VB on the Advanced Placement exams, and I
feel personally insulted, having taken them in Pascal a few years ago).
> 
> The only advantages IMHO Python have over Scheme are: Python provides
> dictionaries (as hash tables) and has a simple yet powerful modular system.
> Scheme R5RS does not specifies hashes among its build-in types. Of course, most
> of contemporary Scheme implementations have built-in hashes (MzScheme,
> Guile). The same goes for modular system (MzScheme has an excellent one).

And Python doesn't have to fight a reputation as a Lisp derivative.

> All in all there is not a single feature in Python (or Perl for this matter)
> which is not already available in Scheme. (Pickling was in Scheme from the day
> one -- "program is data").

Well, Perl is a hell of string processing language. Scheme really isn't.
Sure, it CAN be done it Scheme, but a hundred lines of Scheme can often
be accomplished in one line of Perl (which will invariably consist of
top-row symbols).

> Yet, very little fraction of programmers have ever used Scheme.
> Scheme has been around since 1976 and certainly could address all the needs of
> script programming (and much more). However, every scripting language which came
> later beat Scheme hands down in market acceptance.  Examples are: Basic, Perl
> and now Python.  Well, Python is elegant and is reasonably designed. But why
> Perl gained lion mindshare in CGI and other scripting is a puzzle for me.

Because it's very heavily targetted to slicing and dicing data, pumping
it into a database, and printing a result. It's a UNIX-orienting hacking
tool, made to get a job done without too much concern for theory. Scheme
is a great algorithmic language, but it's hardly practical for many of
the things Perl is good at.

Don't get me wrong; I like Scheme a lot, and next to C I'd rather use
Scheme than most other languages. But there are some things it's not
well adapted to.

> It ought to be a reason why Scheme could not make it into main stream
> programming. Blaming everything on ignorance of an "average programmer" is
> non-contractive approach and it leads nowhere. Average programmers are as they
> are and there is little one can do about it. I know PLT fights a battle to teach
> programming in a right way, but good will and hard work does not guarantee a
> victory.

That is a big part of the problem. If I didn't have to learn it for a CS
class here at Georgia Tech, I probably would have taken one look at
Scheme and run screaming. Its initial learning curve is not bad at all,
but it takes a long time to become truly proficient with the language.
Of course this would be a lot easier with a competent mentor, but they
seem to be in short supply. After Tech's CS1301X class (X = experimental
Scheme approach instead of pseudocode), I found myself with an
appreciation for Scheme's elegance, but without a clue about the more
advanced constructs of the language. I had no idea what a continuation
was, I didn't know why anyone would need a quasiquote, and I knew that
Scheme had a cool macro system but didn't have a clue how to use it. I
had to learn this stuff from assorted online references, most of which
seem to be written in the very pedantic style peculiar to mathematicians
and theoretical computer scientists that often scares newbies away (or
perhaps that was just my impression at the time; I probably could have
understood what I read more readily if I was familiar with more of the
vocabulary).

The point is that a random programmer isn't likely to stumble into
Scheme and learn it overnight, whereas said programmer might find Python
to be a bit 
more closely connected to other languages that he or she already knows.

> So what are the Scheme's deficiencies:
> 
> * Pure prefix syntax comes to mind first.

A feature, not a problem, in my mind. Prefix notation leaves no
ambiguity. I see NO use for infix notation, even on a calculator.
But it's hard to convince newbies of this; it's just one more old habit
they have to overcome.

> * Equally important is that Scheme is proud to lack iteration operators like
>   'while' and 'for' loops because they are redundant in a proper tail-recursive
>   language. It is easy to write missing operators yourself as macros but this
>   task is not for a beginner who wants simply to iterate from 1 to 10.

Perhaps more Scheme implementations should provide these.
Perhaps we need an "extended R5RS" standard so that we can have a
standardized set of extensions across multiple implementations.
Scheme is supposed to be portable, but this is really quite a joke. Just
try porting an average MzScheme program to Guile. Let me know if you
want a bottle of Advil halfway through.

> * Scheme is so much different from your other everyday languages that people
>   simply ignore it, design their own ad hoc languages and then, much later,
>   start to reinvent the wheel by adding Scheme like features to their favorite
>   ad hoc language. At this point they realize (as it was with Perl) that it is
>   too late to make radical design changes.

Maybe so. That doesn't mean that Scheme is the only worthy extension
language, it just means that Scheme has a lot of nice features. The
basic problem I see here is a failure of software designers to
understand the basic concepts that make a language powerful.

> In the case of Python such a poor afterthought are classes. Python class members
> are all public (no information hiding) and a user can add/delete any member of a
> class instance so that class invariants go down the drain. There is no way in
> Python to enforce interface consistency in inheritance hierarchy. I can continue
> et infinitum.

Red Hat Linux's installer crashed twice at an Installfest the other day.
It's written in Python :)
(I don't mean to imply causality; a bad programmer can screw up a good
language just as easily as a good programmer can be limited by a bad
language)

> Uhh, sorry for being pathetic on the eve of presidential elections:-)
> I am finaly at the constructive portion of my e-mail.
> Is it feasible to have a parser which translates Python code into Scheme code so
> that people write Python-like code and can convert it to Scheme so that Python
> users get all the benefits from the features they are just talking about?? Might
> be, significant share of the exsisting Python code would run without
> modifications under Scheme as well.

Hmmm... That's interesting.
Theoretically, it could definitely be done. But would it be practical in
terms of performance?
I've thought of doing the same with Tcl, but I concluded that Tcl is too
heavily based on string substitution for this to be practical.

> Or, can one slip the best Scheme features under the hood of a language which has
> better chances of being widely accepted??

In other words, do future languages have a chance of including powerful
features? Of course. Let's make it happen.

> The sad point which I would like to make: if Scheme, in its present form, could
> not take off since 1976 it will never do. Something on the syntax or/and
> semantics side has to be done so that all the efforts in designing and
> implementing great language are not wasted.

Linux has been competing with NT for years, and it's still not on top. I
personally think Linux is a better OS in general. But it really doesn't
matter - if Scheme solves problems FOR YOU, then use it, and others
might pick it up as well.

I do wish that Scheme would become a mainstream language, though.

-John