[comp.archives] [comp.lang.misc...] Re: CHALLENGE: heterogeneous collections

boehm@parc.xerox.com (Hans Boehm) (03/29/91)

Archive-name: languages/functional/russell/1991-03-28
Archive: arisia.parc.xerox.com:/pub/russell.tar.Z [13.1.100.206]
Original-posting-by: boehm@parc.xerox.com (Hans Boehm)
Original-subject: Re: CHALLENGE: heterogeneous collections
Reposted-by: emv@msen.com (Edward Vielmetti, MSEN)

hoelzle@leland.Stanford.EDU (urs hoelzle) writes:

[Me:]
>> As someone who hasn't yet completely converted to the object oriented religion,
>> this has always struck me as using the wrong tool for the job.  I really don't
>> want a "list of T or subtype of T".  I want a "list of objects that understand
>> foo".  Once I take that view, I have no problems, at least in the few
>> statically typed languages that allow this (e.g. Russell, and probably FX from
>> MIT, and probably Scratchpad II from IBM).  I also don't need to construct
>> my types in such a way that all types that understand foo are "derived" from
>> a common supertype;  I can use inheritance purely where it simplifies the
>> implementation.  And I get full static checking, though elements of the list
>> will, of course, somehow carry the "foo" function with them.  (In Russell, I
>> would build a list of pairs <x: T, T: [algebra containing foo]>.)


>This sounds good.  However, I suspect that these languages don't (didn't?)
>have inheritance at all...?  Plus, some people don't like functional languages.
>Could you post some pointers to the relevant literature?

I'd be glad to.

An introduction to the ideas behind Russell is in Demers and Donahue,
"Data Types are Values", TOPLAS 7, 3 (1985), pp. 426-445.

A (the) Russell implementation is available by anonymous ftp from
arisia.xerox.com:~ftp/russell.tar.Z.  It includes some further documentation.

There is a paper by Jouvelot anf Gifford in the 1991 POPL Proceedings that
cites some of the earlier papers on FX.

None of these languages are purely functional.  They all contain assignment.
(I don't like purely functional languages either.)

As far as I know, these languages do not provide inheritance in the now
conventional sense.  (I know Russell does not.)  They often get a similar
effect by allowing the use of an algebra with many operations in a place
where few operations are called for.  But adding data fields (as opposed
to functions or methods) to existing algebra implementations can be a bit
clumsy.  (You can fake it by adding an extra field whose type is a parameter
to the implementation of the supertype, and instantiating that in the subtypes.)
There are ways to avoid this.  In the case of Russell, they were never
implemented.  I believe Cardelli's language "Quest" is flexible enough
to implement inheritance, and to express the above notions.  It is no doubt
described in a DEC SRC report, though I don't have the reference handy.


Hans
(boehm@xerox.com)