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

Scheme acceptance [no flames]



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.

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

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).

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").

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.

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.

So what are the Scheme's deficiencies:

* Pure prefix syntax comes to mind first.  

* 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.

* 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.

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.

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.
Or, can one slip the best Scheme features under the hood of a language which has
better chances of being widely accepted??

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.

I apologize, for sometimes being pathetic:-)

Thanks,
-- Leo

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+  Leonid Razoumov,               +  E-mail: lrazoumov@qualcomm.com   +
+  Qualcomm Inc.,                 +  http://www.qualcomm.com          +
+  5775 Morehouse Drive,          +                                   +
+  San Diego, CA 92121-1714,      +  VOICE:  +1-858/651-5163          +
+        USA                      +    FAX:  +1-858/658-2113          +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++