Path: news.daimi.aau.dk!news.uni-c.dk!sunic!uunet!rosie.next.com!usenet From: krab@next.com (Kresten Krab Thorup) Newsgroups: comp.lang.beta Subject: unsafe virtual patterns? Date: 20 Sep 1994 21:56:58 GMT Organization: NeXT, Inc. Lines: 31 Message-ID: <35nlra$t2@rosie.next.com> Reply-To: krab@next.com NNTP-Posting-Host: akvavit.next.com How can a Beta compiler know that the program below is incorrect, which I assume it is. The problem I see is that it will try to execute the pattern xx in an instance of Foo. It should be obvious that the compiler should protect the innocent from that kind of thing, or what?As far as I can see, the statement at {*} performs an implicit (unsafe) downcast from Foo to Bar; does that generate a runtime error? Someone, please explain. Kresten (# Foo : (# do INNER #); A : (# O :< Foo; o: ^O enter o[] #); Bar : Foo (# xx :< (# do 'xx' -> putText #) #); B : A (# O ::< Bar do o.xx #); a : ^A do &B[] -> a; &Foo[] -> a {*} #)