Newsgroups: comp.lang.eiffel,comp.object,comp.lang.sather,comp.lang.beta Path: news.daimi.aau.dk!news.uni-c.dk!sunic!news.funet.fi!news.csc.fi!news.eunet.fi!EU.net!howland.reston.ans.net!math.ohio-state.edu!news.acns.nwu.edu!ftpbox!mothost!schbbs!news From: shang@corp.mot.com (David L. Shang) Subject: Re: Cows, Hogs & Farms Reply-To: shang@corp.mot.com Organization: MOTOROLA Date: Wed, 11 Jan 1995 17:25:43 GMT Message-ID: <1995Jan11.172543.21485@schbbs.mot.com> References: <1995Jan10.180233.23224@inca.comlab.ox.ac.uk> Sender: news@schbbs.mot.com (SCHBBS News Account) Nntp-Posting-Host: 129.188.128.126 Lines: 51 Xref: news.daimi.aau.dk comp.lang.eiffel:7151 comp.object:23695 comp.lang.sather:1416 comp.lang.beta:213 In article <1995Jan10.180233.23224@inca.comlab.ox.ac.uk> lady0065@sable.ox.ac.uk (David J Hopwood) writes: > >Run time type check can also be encapsulated by a hog's method, say "try": > > > > function hog::try(food: plant): plant > > enter > > when typeof(food) is corn do > ^^^^^^^^^^^^^^^^^^^^ > > { eat (food); > > return nil; > > } > > return food; > > end; > > try should allow the run-time type of its argument to be a subtype of corn. > It should not restrict it to being exactly corn. Ie. the language should > allow something like: > > when typeof(food) is-subtype-of corn do ... > when typeof(food) is corn do implies that when typeof(food) is-subtype-of corn do while when typeof(food) = corn do means the exact type of corn. I agree that is-subtype-of is clearer and more readable than just "is". Cluster-2 will use typecase statement similar to Sather's: typecase T when T1: ... when subclassof T2: ... // or when <:T2: ... otherwise: ... When "subclassof" is used, the linker and runtime support will load complete type info into the application. Therefore, "subclassof" will have a significant overhead (at least heavier than GC). But once the complete type info is loaded, applications will benefit a lot from a full dynamic typing. Does Sather have a light implementation on "subclassof"? David Shang