Path: news.daimi.aau.dk!news.uni-c.dk!newsfeed.sunet.se!news00.sunet.se!sunic!news.sprintlink.net!newsfeed.internetmci.com!chi-news.cic.net!simtel!lll-winken.llnl.gov!fnnews.fnal.gov!muir.math.niu.edu!mp.cs.niu.edu!vixen.cso.uiuc.edu!usenet From: jacobsn@cs.uiuc.edu (Eydun Eli Jacobsen) Newsgroups: comp.lang.beta Subject: Protected in BETA ? Date: 14 Nov 1995 10:29:27 -0600 Organization: University of Illinois, Dept. of Comp. Sci., Urbana, IL Lines: 40 Message-ID: NNTP-Posting-Host: chip.cs.uiuc.edu X-Newsreader: Gnus v5.0 Is there a way in BETA to model the protected feature of C++ ? A pattern A has a representation attribute priv. Pattern B is a subpattern of A, and should further bind the priv attribute declared in A, ie. extend the representation. On one hand we want the contents of priv to be invisible from the outside and on the other hand we want priv to be virtual. We use the fragment system to obtain the information hiding of priv, but then the priv attribute cannot be virtual, and vice versa. Our "solution" to this is to introduce a virtual pattern describing the representation together with a representation attribute that is a static reference to an instance of the former pattern. A: (# Representation:< (# ... #); priv: @Representation; #); B: A(# Representation::< (# ... #); #); This "information hiding" is not enforced by the compiler, but relies on programmers discipline. :-) We don't like this "solution" and are interested in alternatives. E. Eli Jacobsen & Palle Nowack -- ------------------------------------------------------------------------ E. Eli Jacobsen | Phone: +1 (217) 244-0431 University of Illinois | Home: +1 (217) 337-1366 Dept. of Computer Science | 1304 W Springfield Ave, office 2426 | E-mail: jacobsn@chip.cs.uiuc.edu Urbana, IL 61801, USA | WWW: http://www.iesd.auc.dk/~eej ------------------------------------------------------------------------