Path: news.daimi.aau.dk!jacobse From: jacobse@daimi.aau.dk (Jacob Seligmann) Newsgroups: comp.object,comp.lang.eiffel,comp.lang.sather,comp.lang.beta,comp.lang.modula3 Subject: Re: Cows, Hogs & Farms Date: 9 Jan 1995 15:21:56 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 65 Message-ID: <3erkak$sm7@belfort.daimi.aau.dk> References: <3eih36$94g@network.ucsd.edu> <1995Jan6.164948.4782@schbbs.mot.com> <1995Jan9.005627@hobbit> NNTP-Posting-Host: tatra.daimi.aau.dk Xref: news.daimi.aau.dk comp.object:23573 comp.lang.eiffel:7131 comp.lang.sather:1398 comp.lang.beta:206 comp.lang.modula3:3309 Mark S. Hathaway wrote: > > or BETA's form: > > > > MONOCULTUREFARM > > (# ANIMALT :< HERBIVORE > > attr livestock : @list (# eleT::ANIMALT #); > > attr foodstock : @list (# eleT::ANIMALT.FOODT #); > > #) > > [...] > > Since "ANIMALT :< HERBIVORE" is inside the "(#" & "#)" enclosure I wouldn't > guess you could create a MONOCULTUREFARM(COW). But you can! In BETA, you would say MONOCULTUREFARM (# ANIMALT :: COW #) to denote a subclass of MONOCULTUREFARM in which the virtual attribute ANIMALT is further-bound to COW. That is, genericity is handled through inheritance and virtuals alone - there is no special template mechanism whatsoever! Of course, this is only possible because BETA allows virtual types, not just virtual methods. This is typical of how BETA offers only a few basic mechanisms, but makes them powerful and orthogonal, so that they can be combined to obtain a wide range of features for which most other languages provide special mechanisms. > It's not especially readable, is it? > [...] > Yes, the language should provide a way to express something. That's why > I cringe when I see syntax like BETA's. :-) The reverse sign of the minimalism coin, of course, is the need to use more syntax to express a feature which is obtainable through a special (nice-looking) construct in another language. I agree that MONOCULTUREFARM [COW] or even MONOCULTUREFARM [ ANIMALT = COW ] is easier to read than MONOCULTUREFARM (# ANIMALT :: COW #) However, when working with BETA, you quickly learn to recognize use patterns such as the one above. It's not a big deal in practice, really. Best regards, /Jacob Seligmann ------------------------------------------------------------------------ Computer Science Department Phone: +45 89 42 31 88 Aarhus University Direct: +45 89 42 32 74 Ny Munkegade 116 Fax: +45 89 42 32 55 DK-8000 Aarhus C, Denmark E-mail: jacobse@daimi.aau.dk ------------------------------------------------------------------------ More info on BETA is available at URL http://www.daimi.aau.dk/~beta/info ------------------------------------------------------------------------