From: jcm@hgc.edu (James McKim)
Subject: Re: Freeware, Sather, types and other questions.
Organization: The Hartford Graduate Center
Date: Wed, 14 Oct 1992 15:38:13 GMT

In article <Bw2C0v.LE3@dcs.ed.ac.uk> pdc@dcs.ed.ac.uk (Paul Crowley) writes:
>I just recently read Meyer's "Object Oriented Software Construction"
>and I'm a convert.  In an ideal world, I'd never write another line of
>C again.  Is there a freeware version of Eiffel?  If not, are there
>similar languages which are free?

Welcome aboard! Currently Sather is the only Eiffel-like language
available for free.

>
>I know about Sather and it seems very nice indeed.  One thing I found
>strange: it allows you to assign to a variable from a supertype of
>that variable, assuming that you know what you're doing.  Presumably
>if you get it wrong and you subsequently try to invoke a method not
>available on the supertype, Bad Things Happen.  This seems an especial
>shame since apart from things like divide-by-zero errors Sather
>provides few opportunities for Bad Things to Happen which is most
>refreshing to someone who's used to C's habit of causing Bad Things
>like segmentation violations to Happen at the drop of a slighly bugged
>hat.
>
>In Xt (which is the only real experience of anything approximating to
>OO programming that I have) there's a rather nice function called
>XtIsSubclass which does what it says it does, so you could test before
>you attempt to do any such assignments.  Do primitives exist which
>attempt such an assignment and leave the variable empty if the classes
>don't work out?  Is this what people mean by "downcasting"?


Eiffel 2.3 (and perhaps earlier versions) allows a reverse assignment
attempt. If y's type is an ancestor of x's type then the syntax
            x ?= y ;
is legal. If x's run-time type is compatible with y's then the
assignment actually takes place, otherwise x.Void is True. I'm
not sure what "downcasting" is.


>
>I've been poking my head around the corner of the debate around other
>kinds of typing.  I did a little ML here in Edinburgh and was left
>unconvinced of the usefulness of Milnerian polymorphism, especially if
>you leave out the higher-order bits (which I didn't like either and
>now consider a kludge solution to what dynamic dispatch solves well).
>What sort of non-trivial classes could you use them to implement?  For
>that matter, I can only think of about three classes you can implement
>with parameterized types, and it seems only a small overhead to use a
>top-level type and a subclass-testing primitive.

Hmmm... My most common use of parametrized types is with container
classes. By declaring these with a generic type parameter, e.g.
STACK[T], ARRAY[T], LIST[T], I can easily write classes that
will work correctly regardless of the type of element they contain.
Eiffel also allows constrained genericity. For example the class
DECK[T -> CARD] must be instantiated with an actual type parameter that
is compatible with CARD. This allows objects of type T within DECK
to access CARD features like, say, suit.

>
>Are there any tools for writing X windows programs in a language with
>all the best OO features (ie strong static typing, dynamic despatch,
>multiple inheritance, garbage collection)?

ISE Eiffel comes with a graphics library which accesses X. ISE Eiffel
version 3 due out Real Soon Now includes (as an option) the library
EiffelVision which will allow access to Motif and Open Look.

>
>Should I be doing my homework somewhere else before sending these
>questions to the group?  Perhaps there's somewhere to discuss Sather
>itself?  Thanks for any answers.

Ask away! There is a FAQ for this group that gets posted irregularly.
If you like I'll send you a copy.

>--
>  __                                ____
>\/ o\ Paul Crowley pdc@dcs.ed.ac.uk \  /
>/\__/ "SET ME ON FIRE!" - Big Black  \/


Hope this helps,
-- Jim
-- 

*------------------------------------------------------------------------------*
Jim McKim  (203)-548-2458     In exactly 3.2 seconds it will be a few 
Internet:  jcm@hgc.edu   minutes to 5:00.