Newsgroups: comp.lang.eiffel,comp.object,comp.lang.modula3,comp.lang.sather,comp.lang.beta Path: news.daimi.aau.dk!news.uni-c.dk!sunic!lunic.luth.se!eru.mt.luth.se!bloom-beacon.mit.edu!panix!news.mathworks.com!hookup!swrinde!pipex!lyra.csx.cam.ac.uk!warwick!uknet!comlab.ox.ac.uk!sable.ox.ac.uk!lady0065 From: lady0065@sable.ox.ac.uk (David J Hopwood) Subject: Re: Cows, Hogs & Farms Message-ID: <1995Jan12.010822.19169@inca.comlab.ox.ac.uk> Sender: david.hopwood@lmh.oxford.ac.uk Organization: Oxford University Computing Service, 13 Banbury Rd, Oxford, UK References: <1995Jan3.223031@hobbit> <1995Jan4.191910.13968@schbbs.mot.com> <1995Jan9.021043@hobbit> Date: Thu, 12 Jan 95 01:08:22 GMT Lines: 51 Xref: news.daimi.aau.dk comp.lang.eiffel:7157 comp.object:23712 comp.lang.modula3:3322 comp.lang.sather:1422 comp.lang.beta:214 In article <1995Jan9.021043@hobbit>, Mark S. Hathaway wrote: ... > David Shang wrote: ... >> In reality, we always have exceptions. We can use covariance to rule out a >> general principle and use run-time type check for a few exceptions. As to >> the animal example, it is clearly worthwhile to divide animals into >> herbivires, carnivores and (?)(animals eating both food) according to the >> type of their food. We can use covaraince. But it might be very hard to >> rule out a general principle for the futher classification for a certain >> number of animals. ... >> We are not developing a commercial software for zoologists, are we? These >> are only pedagogical examples. Be wise to make things as simple as possible >> -- just for the key points you want to say. > >I have created a few examples in the past which thoroughly confused people >because they weren't realistic enough. I'm trying to avoid the sins of >my past. Same here. ... >I'd certainly be interested to read further discussion on the differences >between these classes and those of Sather & Eiffel. There seem to be some >rather major differences. It might help to read about the typing systems of Cecil, Trellis/Owl, or ML (and various other functional languages), which use a similar approach to Cluster. A paper on the Cecil typing system is at http://www.cs.washington.edu/research/projects/cecil/www/cecil-spec.html At least, I think that's the right paper - I can't read postscript on this terminal to check. Don't get too confused by the stuff on multi-methods - it's fascinating, but not really relevant. Genericity is described near the end of the paper. A good account of dynamic genericity (also called Milner polymorphism) in functional languages is given in An Introduction to Functional Programming Richard Bird and Phillip Wadler Prentice Hall series in Computing Science (sorry, don't have the ISBN on me). Hope this helps, David Hopwood david.hopwood@lmh.oxford.ac.uk