Path: news.cs.au.dk!olm From: olm@cs.au.dk (Ole Lehrmann Madsen) Newsgroups: comp.lang.beta Subject: Re: Is Beta a statically typed language? Date: 13 Jan 1999 22:09:11 GMT Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 95 Message-ID: <77j5i7$ef9$1@xinwen.cs.au.dk> References: <77b7fc$l2o$1@xinwen.cs.au.dk> NNTP-Posting-Host: ariel.cs.au.dk X-Trace: xinwen.cs.au.dk 916265351 14825 255.255.255.255 (13 Jan 1999 22:09:11 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 13 Jan 1999 22:09:11 GMT X-Newsreader: NN version 6.5.3 (NOV) Xref: news.cs.au.dk comp.lang.beta:11789 In Jean-Louis Leroy writes: >In article <77b7fc$l2o$1@xinwen.cs.au.dk>, Ole Lehrmann Madsen wrote: >> BETA is not completely statically typed. >I'm not obsessed with perfect type safety anymore. After having had a very >successful relationship with C++ as a one-man team, I've reconsidered after >spending the last two years with colleagues who were competent and talented >programmers without being - or willing to become - language lawyers with a law >book that runs for 800 pages. > ... >Back to the point; my Animal & Fruits example was of course poor design, >because an animal that only eats bananas is *not* an animal that eat all >fruits. >Unfortunately the current Beta collections suffer from the same problem: >(# > Person: (# #); > people: @Set (# element:: Person #); > backdoor: ^Set >do > &Person[]->people.insert; > people[]->backdoor[]; (* no warning *) > &integerObject[]->backdoor.insert (* trouble *) >#) >The problem here is that there exists an automatic, silent conversion from a >Set of Persons to a Set of Objects. Couldn't this be avoided by introducing >some form of 'partially private' inheritance? For example, by specifying that a >subpattern that refines a virtual type that is used in an enter-list inherits >the implementation of the superpattern without being a subtype of it? One of the design goals for BETA is that we would like a subpattern always to define a subtype, since this is a simple model. In the above example there may be patterns that compute various properties on arbitrary sets, such as the size of the set. We would thus like to be able to pass arbitray subpatterns of Set to such patterns. The prize for this is that run-time type checking is needed in some cases. Regarding private inheritance, we have not found that it is necessary to introduce. In BETA you can often use part objects for this: Consider Address: (# street, city: ^text; display:< (# do INNER; street[] -> putline; city[] -> putline #) #) Person: (# name: ^text; adr: @address (# display::< (# do name[] -> putline #) #) #) The point here is that by using singular objects as part objects you can bind virtuals that refer to attributes of the enclosing object. This is not as easy in most other OO languages. Private inheritance is often used for this. In the above example you do not get direct access to all the attributes of Address when you 'inherit' from it as a part object. This you of course do when you privately inherit form it as a super pattern. This issue is further discussed in Part object and their locations which you may find on http://cs.au.dk/~beta We are working on making some of the other references available via the Web. We will also be happy to send paper versions. Please send us an address if you want this. ---olm >Aw, one step toward Beta++ :( >> We have discussed these issues in several papers >I have tried to find them in electronical form, without success so far. How can >I obtain them? >Jean-Louis Leroy >http://ourworld.compuserve.com/homepages/jl_leroy/