Path: news.daimi.aau.dk!sbrandt From: sbrandt@daimi.aau.dk (S|ren Brandt) Newsgroups: comp.lang.beta Subject: Re: Part objects Date: 27 Apr 1995 08:46:07 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 67 Message-ID: <3nnlkf$q1q@belfort.daimi.aau.dk> References: <9504201034.ZM19488@ody.zcu.cz> NNTP-Posting-Host: quercus.daimi.aau.dk Thus spake novy1@odysseus.zcu.cz (Marek Novy): >I found a strange aspect of part objects in Beta. They are still living >(accesible in memory) after the enclosing object has been deleted. >Consider this: >complex: (# x,y:@real; #); >c:^complex; >strange: > (# new:@complex; > exit new[] > #); >Every invocation like &strange->c[] create a new independent complex object. Just to make sure we agree on terminology: Instances of "strange" have a *static* part object which is an instance of "complex". Given an instance "s" of "strange" and its part object "new", these two objects are created together, and they disappear (i.e. are garbage collected) together. So, as long as someone holds on to a reference to "new", "s" cannot be garbage collected, and thus stays around. >It's OK from the practical point of view but not from theoretical one. Beta is >a language based on a 'physical modeling' approach. So it is not very clear if >part objects are in fact physically independent. As far as I understand the BETA conceptual framework, static part objects (declared using "@") are *not* independent of their location, i.e. the object of which they are part. In fact, according to the following reference, it should be possible to get a reference to "s" by writing "new.location": @INPROCEEDINGS{BETALocations, AUTHOR = "O.L. Madsen and B. M{\o}ller-Pedersen", TITLE = "{P}art {O}bjects and {T}heir {L}ocation.", BOOKTITLE = "Technology of Object-Oriented Languages and Systems--TOOLS 7", EDITOR = "G. Heeg, B. Magnusson and B. Meyer", YEAR = {1992} } Although not implemented in the current Mjolner BETA System, this clearly prevents "s" from becoming garbage until "new" itself is garbage. From an implementational point of view, the reason for the behaviour you observe is that "new" is in fact inlined inside "s", and therefore the two objects must be reclaimed together. -- Soren ************************************************************************** Soren Brandt, Computer Science Department, Aarhus University Ny Munkegade 116, DK-8000 Aarhus C, Denmark. E-mail: sbrandt@daimi.aau.dk, Phone: +45 89 42 32 57, Fax: +45 89 42 32 55 ************************************************************************** >-- >Marek Novy, University of West Bohemia >********************************************************************** >Look at BatOS - revolution in OS design: http://odysseus.zcu.cz/~novy1 >********************************************************************** >home: 5.kvetna 670 campus: Machova 20, p.619 > 34201 Susice 30000 Pilsen > Czech Republic Czech Republic > tel. 0042-1878711 email: novy1@odysseus.zcu.cz >**********************************************************************