Eiffel thoughts?
Richard A. O'Keefe
ok at cs.otago.ac.nz
Wed Feb 11 23:31:29 UTC 2004
There was some discussion of Eiffel.
I like both Eiffel and Smalltalk. For one thing,
they are both "objects all the way down". Eiffel has
none of that ludicrous distinction between primitive types
(basically, numbers) and object types that you find in Java or C++.
Each of them emphasises one side of the elephant.
I particularly like the way I can state class invariants,
method preconditions and postconditions, loop invariants,
and so on in Eiffel. This stuff is both part of how I
*design* a class and an extremely important debugging tool.
Meyer has taken a very cautious approach to language design,
but Eiffel has seen some fairly large changes. For example,
Eiffel has only recently acquired "agents" (the Eiffel name
for blocks).
I tend to dislike Eiffel's verbosity. For example,
make is
local
p: COMPARABLE_PAIR[INTEGER,STRING]
do
!!p.make2(-217, "two hundred and seventeen")
print(p)
print('%N')
print(p.compare(p))
print('%N')
end
would be
make
|p|
p := Pair first: -217 second: 'two hundred and seventeen'.
Transcript print: p; cr; print: p ? p; cr
where
Magnitude>>
? aMagnitude
self < aMagnitude ifTrue: [^-1].
aMagnitude < self ifTrue: [^1].
^0.
is a method which is unaccountably missing from Magnitude (Squeak)
and <magnitude> (ANSI); it should be the core operation.
Q2. Is static typing desirable?
I was doing some work recently in a dynamically typed language.
I made no fewer than 6 mistakes in one procedure.
Static type checking would have found 2 of them.
My test cases (which were pretty trivial, to be honest) found all of them.
More information about the Squeak-dev
mailing list
|