Path: news.daimi.aau.dk!news.uni-c.dk!uninett.no!news-feed.inet.tele.dk!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!newsfeed.nacamar.de!news-kar1.dfn.de!news-fra1.dfn.de!news-koe1.dfn.de!ilex.fernuni-hagen.de!news From: Arnd Poetzsch-Heffter Newsgroups: comp.lang.beta Subject: Strong Typing in BETA Date: Tue, 03 Jun 1997 16:53:44 +0200 Organization: FernUniversitaet Hagen Lines: 53 Message-ID: <33942FF8.6C9EEC3B@fernuni-hagen.de> NNTP-Posting-Host: pcpoet1.fernuni-hagen.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.25 i586) Xref: news.daimi.aau.dk comp.lang.beta:11124 Hi, I am currently learning BETA and have a question about typing. Consider the following BETA program: Program : (# Super : (# AttrPattern :< Object; attr : ^AttrPattern Init :< Object #) Sub : Super (# AttrPattern ::< (# i: @int #) Init ::< (# do 1 -> attr.i #) #) sp: ^Super; sb: ^Sub; do &Sub[] -> sb; sb -> sp; (1) &Super[] -> sp.attr; (**** Dynmic Type Error ???? *) (2) &sp.Init #) In line (1), a reference to a newly created Super-object X is assigned to the attribute attr of a Sub-object. X has no attribute i. Is this assignment correct according to the typing rules of BETA? Or: Does this assignment cause a runtime error? Or: What happens with the call of Init in line (2) which executes Sub.Init (as far as I understand) and which accesses attr.i ? Thanks for your help! (As the above program is the first BETA program I worte, it might contain some errors, but I hope the underlying problem is nevertheless clear.) Best regards, Arnd Poetzsch-Heffter _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ _/ _/ Prof. A. Poetzsch-Heffter tel: ++49 2331 987 2172 _/ LG Prakt. Informatik V _/ FernUniversit"at email: poetzsch@fernuni-hagen.de _/ D-58084 Hagen URL: http://voss.fernuni-hagen. _/ de/pi5/pi5.html