Path: news.daimi.aau.dk!news.daimi.aau.dk!eernst From: eernst@tatra.daimi.aau.dk (Erik Ernst) Newsgroups: comp.lang.beta Subject: Re: Something like computed names in BETA ? Date: 11 Nov 1994 18:28:38 GMT Organization: DAIMI, Computer Science Dept. of Aarhus Univ. Lines: 72 Distribution: world Message-ID: References: <39tqrf$q5m@poseidon.uni-paderborn.de> NNTP-Posting-Host: tatra.daimi.aau.dk In-reply-to: ogeisser@poseidon.uni-paderborn.de's message of 10 Nov 1994 20:04:15 +0100 > "A computed reference may be used in a computed remote name, > which has the form: > > (ComputedReference).name > > [...]" > > Can you do something like this in BETA: > > Reference.(ComputedName) > > I don't think it works this way, but you might get the > idea want I want ! A work-around which may be applicable: use pattern variables. The computation would perhaps look like "obj.ComputePtn->pv##", binding "pv" to some pattern enclosed in the pattern of which "obj" is an instance. But the type of "pv" might be a problem: it can't express more than what is known about all possible outcomes of "obj.ComputePtn", and that might not be enough to make the pattern really useful. "Reference.(ComputedName)" would be a very nice possibility. It would be quite different from "(ComputedReference).name", though, as there would not be a simple re-writing scheme into "BETA-without-it", like (ReferenceExpression).name; ---> (# temp: ^appropriatePattern; do ReferenceExpression -> temp[]; temp.name; #); To obtain the value corresponding to "reference-to-name" you would have to introduce something which has been proposed under the name "attribute variables". There should also be some mechanism for traversing all possible values for such an attribute variable, given a suitable context. (Such as "scan all patterns immediately enclosed by the pattern given by this pattern variable"). And, to keep BETA statically typed, you would need some way to obtain and exploit type information regarding those patterns. The language BETA doesn't have it (for now), and I don't expect anything like that to become part of the Mjolner BETA System (MBS) anytime soon. > Another question is: Can I determine at runtime which > methods an object understands ? Again, an answer to such a question would have to be some set of attribute variables. Or, of course, one could use the meta-programming system of MBS to retrieve information at run-time about the structure of objects; still, if possible, it would be a quite verbose and error-prone way to create and execute instances (i.e. to USE those methods which the given object apparently understands). I think this all boils down to: BETA is statically typed (the only kind of run-time type check is in reference assignment, everything else is statically type-safe), and the notion of "reference to name" is quite hard to integrate without compromising this type safety. Soren Brandt (who proposed the attribute variables) might elaborate. HopeThisHelps -- Erik Ernst eernst@daimi.aau.dk Computer Science Department of Aarhus University, Denmark