Syntax
Mark van Gulik
ghoul6 at home.com
Thu Feb 17 05:02:50 UTC 2000
In my programming language Avail I address some of the syntax issues that
have been discussed in this newsgroup (in the *one* day since I subscribed).
Operations are defined with underscores where the arguments go, such as
"_+_" for addition. Some good examples are:
"if_then_else_"
"_()" - block invocation
"_(_)" - ...with an argument
"Print_" - simple console i/o
"Halt" - a zero-argument message (Avail is
multiply polymorphic)
"true" - another zero-argument message - no need for
special syntax for constants
"(_)" - why build in parentheses when you can just
add them later?
"_[_]" - subscripting
"_" - type conversion (this one has some subtle issues)
"While_loop_" - better symmetry for tests at top or bottom
"Until_loop_"
"Loop_while_"
"Loop_until_"
"Loop_"
The super notation is a pun on C++'s syntax...
x :: Number + y :: Number
This says treat x and y as though they are both of type Number for the
purpose of method lookup of the "_+_" operation. Note that I could have
supered just one of the arguments instead of both. In the 500K of source in
the current library, the :: syntax is only used once, to disambiguate
multiple inheritance of the "_is at end" in Input File, which inherits the
message from both File and Iterator...
Method "_is at end" is [file : Input File |
/* Cast the message up to File (not Iterator). */
file :: File is at end;
] : boolean;
To see more, take a look at http://www.ericsworld.com/Mark/HTML/Avail.html
Getting back to Squeak, there was a time in the late '80s when Smalltalk-80
(version 2.5?) had a special notation for directed super send. For example,
"anInteger Object.printOn: aStream" was how you would invoke the Object
implementation of printOn: on an integer. This was to support multiple
inheritance, and it disappeared in the next release (along with the
experimental multiple inheritance code that had leaked into that release).
I don't like the concept of counting steps in the hierarchy, but if I did,
there's an obvious English word that many of you have heard before:
superduper.
More information about the Squeak-dev
mailing list
|