How about Smalltalk-2000?

Jecel Assumpcao Jr. jecel at merlintec.com
Wed Feb 16 21:27:05 UTC 2000


Warren Postma wrote:
> >How much further do you want?  I'm serious - please explain, and you may
> >find (as here) that what you want already exists.
> 
> Well, what about these array operations:
> 
> a[5] := 10					" obvious array syntax "
> a[5][9] := 0			      " multiple levels of arrays "
> a[0:10] := 0  				" initialize a slice "
> a[5:10] := b[10:15]			" slice "
> a["key"] := Value 			" dictionary "

Well, I am guessing you know that you could write these things in Smalltalk as
(by adding a Slice class, of course):

     a at: 5 put: 10
     (a at: 9) at: 5 put: 9
     (a slice: 1 to: 11) put: 0      "Smalltalk indexes start at 1"
     (a slice: 5 to: 10) put: (b slice: 10 to: 15)
      a at: 'key' put: value

So what you need is to be able to write the expressions as you showed above and
have the compiler generate code as if you had written them the way I did, right?

Since you want to use brackets it is a bit more complicated, but patching
Parser to obtain this result is probably no more than a few hour's work. Of
course, as I said in my other email it might be interesting for you to study
APL if you think this kind of thing will help your programs (though APL does
use brackets as an indexing operator ;-)

Looking at the Scanner class, I note that binary selectors can be any number of
characters long. These characters can be any except for tab, lf, ff, cr, space,
digits, letters, ", #, $, ', :, (, ), ., ;, [, ], {, }, |, upArrow and
leftArrow.

You are free to write expressions like

           7 <==@==> 9

as long as you define a #<==@==> method for numbers. And you can write

         'hello' + 'world'

by defining a #+ method for String (or Collection even).

About your other comments on how the syntax has been holding Smalltalk back
somehow, I don't think that is true. I know a few languages for which is the
case (Beta would be more popular if it looked more like C, for example), but
for Smalltalk the things people ask/complain about are:

    1) Isn't it dead? Isn't it something Xerox did in the 70s and then C++
improved upon, and then Java made even better?

    2) Isn't it too slow for anything but toy programs?

    3) I can't use it if it doesn't generate a small .EXE file I can distribute.

The first two are simply myths, while the third is true for most Smalltalks but
not for all. I don't personally know people who went past these obstacles and
decided to give Smalltalk a try but then gave up when they saw how different
the syntax was. It might be your case and that of a few others on the list, but
I don't think this is what is holding the language back in general.

Except for the array indexing syntax above, all you other suggestions are
doable without any patches to the compiler. But note that a friend of mine
created a file he called "betterC" with things like

#define BEGIN  {
#define END  }
#define AND  &&

and so on. He tried to get people around here to standardize on this so that
the first line in each program would be

#include <betterC>

and the rest could be written in what he considered a much more readable form.
Nobody else adopted it and he was very upset about it. I hope you won't let our
reaction to your suggestions have the same effect.

-- Jecel





More information about the Squeak-dev mailing list