On Sun, May 12, 2002 at 12:30:20AM +0200, Pixel wrote:
> FYI Ruby has:
>
> a.type <= b.type or a.type == b.type
>
> where the various operators (<, >, ==, != ...) are overloaded
> according to the subtyping relation.
>
> as for me,
> - i find the "==" very readable,
> - but i'm not sure "<=" is very readable
> (who knows that a supertype is "greater", and a subtype is "smaller")
Well, it comes from set notation - and you used the prefixes 'sub' and
'super' exactly as they are used in sets. :) The <= is an ASCIIfication of the
"is a subset of" operator (also used as such in, e.g., Pascal).
The real operator, U+2286, uses a 'U' rotated 90 degrees clockwise in place
of the '<' symbol, and - like the real mathematical symbol for
"less than or equal" - has a line underneath that symbol instead of an
'=' next to it.
Anyway, if you regard a class as the set of objects which can be
treated as instances of that class, then use of a Rubylike notation
(and the terms 'subclass' and 'superclass') follows logically.
--
Mark REED | CNN Internet Technology
1 CNN Center Rm SW0831G | [EMAIL PROTECTED]
Atlanta, GA 30348 USA | +1 404 827 4754
--
FORTRAN is not a flower but a weed -- it is hardy, occasionally blooms,
and grows in every computer.
-- A.J. Perlis