[Top][All Lists]

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

Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax

From: Paolo Bonzini
Subject: Re: [Help-smalltalk] [RFC] Smalltalk scripting syntax
Date: Sat, 10 Mar 2007 17:31:08 +0100
User-agent: Thunderbird (Macintosh/20070221)

> Although I don't object to the syntax quite as much as you do, I do
> think that some of the examples seem to violate the normal selector
> precedence, and that is a Bad Thing. In particular this:
> ChessPiece class >> test: side [ ... ]

Note that this is no valid syntax in Smalltalk.  I see this "as if"
the "test:" keyword where an object is expected introduces a
"message pattern" which as the same precedence as an object (i.e.
very high).

> and this:
> Class name: RandomInteger class [ ... ]

Likewise, here the '[' where a keyword is expected introduce
a "scoped definition" which has instead a very low precedence.

It's like in standard math syntax, where "-/+" has high precedence if
it is unary, and low precedence if it is binary.

>> Then there are also a few minor other things that most people would not
>> find to be a problem at all:
>>   * "Object subclass: #SomeClass" is shorter and more to the point than
>> "Class name: SomeClass extends: Object".
> I agree. My opinion is that the first advertises the fact that
> Everything Is An Object. Still, I can live with it.

I would prefer "Object subclass: SomeClass" (okay, I know why you would
like the hash).  If it is preferred, Daniele will implement it instead
of "Class name: SomeClass extends: Object".

The nice thing of "Class name: SomeClass extends: Object" is that it
pairs nicely with the syntax to define class extensions, which is

    Class name: SomeClass [

Please comment on this.

>>       <category> is followed by a
>>       "comment", some
>>       | temporary variables |, and an
>>       ^answer.
> I would hope that the syntax is still free-form, and all four of those
> are optional, are they not?

Of course.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]