Path: news.daimi.aau.dk!glad From: Michael Thomsen Newsgroups: comp.lang.beta Subject: Re: Global Variables Date: Sun, 12 May 1996 16:24:43 +0200 Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 64 Message-ID: <3195F4AA.4B1E@daimi.aau.dk> References: <318F2E76.41C6@idefix.physik.tu-berlin.de> <3192154C.41C6@idefix.physik.tu-berlin.de> NNTP-Posting-Host: franc.daimi.aau.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0b2 (X11; I; SunOS 5.4 sun4m) Kai Petzke wrote: > > Claus-Peter Knaut wrote: > > > We want to use the persistent store to save tuples of a > > relation on a disk. But to use a global variable in tuple, tuple.bet > > has to have its ORIGIN in a global database slot. To save the tuple, > > the pattern has to be declared in betaenv.bet, best in lib:attributes > > SLOT. > > Well, I have used the persistentstore quite a lot, and I put objects in > it, which have been defined below an lib:attributes slot. The only type > of objects, that the persistentstore does not like (according to my > experience) are the ones, that are directly or indirectly part of an > component. In particular, the PROGRAM module of each BETA application > is such a component. So the following piece of BETA won't work: > > ORIGIN 'betaenv'; > INCLUDE 'persistentstore'; > INCLUDE 'database'; > --- program: descriptor --- > (# > mydb: @database; > ps: @persistentstore; > do > (* initialisation left out *) > (mydb.newTuple, 'tuple1')->ps.put; > #); Correct - this will not work, the reason being that besides the persistent root itself (mydb.newTuple) the transitive closure of the roots reachable surroundings is also be stored. In your example mydb is reachable from mydb.newTuple, and from mydb all of betaenv is reachable. So infact what the example would do, if it was legal, was to store all of betaenv and what i from that reachable, which of course would not make sence. > > However, the following should work: > > ORIGIN 'betaenv'; > INCLUDE 'persistentstore'; > INCLUDE 'database'; > --- program: descriptor --- > (# > mydb: ^database; > ps: @persistentstore; > do > &datbase[] -> mydb[]; > (* further initialisation *) > (mydb.newTuple, 'tuple1')->ps.put; > #); > > Kai Correct - defining persistent patterns in the lib slot in betaenv avoids the above mentioned problem. Kind Regards, Michael... -- ----------------------------------------------------------------------- Michael Thomsen - Student of Comp. Science, Uni. of Aarhus, Denmark URL: http://www.daimi.aau.dk/~miksen/ Email: miksen@daimi.aau.dk -----------------------------------------------------------------------