[Bluej-discuss] confusion over =
Michael Kölling
M.Kolling at kent.ac.uk
Fri Nov 30 11:44:49 GMT 2007
On 30 Nov 2007, at 11:22, Michael E. Caspersen wrote:
> ... teaching language Blue...
Yes, in Blue everything was an object. And operations had a uniform
syntax, for example
2.add(4)
But then there were "aliases". I have just looked at the language spec
again (after a long time!). Here is what it says:
"All types in Blue are classes and all data are objects. This general
rule
simplifies the language design. There are, however, a number of data
types
for which it is convenient to use syntax other than the Blue object
call to
perform one of their operations. The reason for this can be:
• Another syntax is commonly used and is therefore more intuitive (e.g.
3 + 5 for integer addition, rather than 3.add (5) ).
• Another syntax simplifies use of elementary constructs which should
be
used by beginners before the underlying language concepts need to be
understood, e.g.
print (“result=“, 42)
instead of
output.write (“result=“.concat (42.toString))
• Another syntax is more convenient (usually because it is shorter, see
above).
For these reasons, several operations on the predefined classes are
supported
by special syntax. This special syntax is allowed in addition to the
standard
object-call syntax generally available for all classes, and is
referred to as
aliases.
...
Note that aliases are a pure syntactic addition which does not add any
functionality to the language. They do not affect the semantics or the
theoretical language description of Blue (although they are part of the
language), and are purely intended to increase readability and
intuitivity of
statements. "
Oh yes, and Blue uses, of course, = for equality check and := for
assignment... :)
If anyone is really interested in dead old languages, the spec is here:
http://www.cs.kent.ac.uk/people/staff/mik/blue/doc/spec-102.pdf
Michael
More information about the bluej-discuss
mailing list