Path: news.cs.au.dk!krab From: Kresten Krab Thorup Newsgroups: comp.lang.beta Subject: Re: Is Beta a statically typed language? Date: 09 Feb 1999 17:48:46 +0100 Organization: DAIMI, Computer Science Dept. of Aarhus Univ. Lines: 46 Message-ID: References: <77b7fc$l2o$1@xinwen.cs.au.dk> NNTP-Posting-Host: california.cs.au.dk Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xinwen.cs.au.dk 918578931 13367 255.255.255.255 (9 Feb 1999 16:48:51 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 9 Feb 1999 16:48:51 GMT X-Newsreader: Gnus v5.3/Emacs 19.34 Xref: news.cs.au.dk comp.lang.beta:11813 Jean-Louis Leroy writes: > 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. You're right that there is a silent conversion, but is not the problem. The problem is the insertion of an ^IntegerObject into Set. &IntegerObject[] -> backdoor.insert The compiler flags this as problematic (it warns) because "backdoor" may refer to a subtype of Set which has a stronger requirement on the element type, (and that is indeed the case here). Our new paper "Unifying Genericity" to appear at ECOOP'99 discusses these issues at further detail. http://www.cs.au.dk/~krab/ug3.{pdf,dvi,ps.gz} Herein we suggest a type system similar to BETA's which flags these situations as errors rather than warnings. (Plus we add some structural subtyping for virtual types, making them more useful as parameterized classes). The "Virtual Types for Java" paper mentioned earlier is at http://www.cs.au.dk/~krab/virtuals.{dvi,ps} -- Kresten Kresten Krab Thorup, M.Sc., "I like my eggs ploded" Dept. of Computer Science, University of Aarhus Container #210, Åbogade 34, DK-8200 Aarhus N Ph: +45 8942 5665; Mobile: +45 2343 4626; Fax: +45 8942 5624