Path: news.daimi.aau.dk!news.uni-c.dk!uninett.no!nntp.uio.no!ifi.uio.no!not-for-mail From: Alf-Ivar Holm Newsgroups: comp.lang.beta Subject: Re: Is overwriting possible in BETA? Date: 09 Jun 1997 15:03:00 +0200 Organization: The Department of Informatics, University of Oslo, Norway Lines: 49 Sender: alfh@byleist.ifi.uio.no Message-ID: References: <339BEE9A.B0F69DF@fernuni-hagen.de> NNTP-Posting-Host: byleist.ifi.uio.no X-Newsreader: Gnus v5.4.56/Emacs 19.34 Xref: news.daimi.aau.dk comp.lang.beta:11137 Arnd Poetzsch-Heffter writes: > Is it possible in BETA to overwrite an attribute of a superpattern > within a subpattern? It is legal, but to access the overwriting attribute in the subpattern, you have to have the right qualification. Both the overwriting and the overwritten attributes are part of the subpattern and may be accessed directly. The following program accesses the attributes through some references qualified at different "levels": ORIGIN '~beta/basiclib/current/betaenv'; --- PROGRAM : descriptor --- (# a: (# attr:< (# do 'a'->putline; inner #);#); b: a(# attr:: (# do 'b'->putline; #);#); c: a(# attr: (# do 'c'->putline; #);#); ap: ^a; bp: ^b; cp: ^c; do &b[]->bp[]->ap[]; '--ap.attr (b)--'->putline; ap.attr; '--bp.attr (b)--'->putline; bp.attr; &c[]->cp[]->ap[]; '--ap.attr (c)--'->putline; ap.attr; '--cp.attr (c)--'->putline; cp.attr; #) This program outputs: --ap.attr (b)-- a b --bp.attr (b)-- a b --ap.attr (c)-- a --cp.attr (c)-- c The last two lines of the program shows how the overwriting works. Affi