Path: news.daimi.aau.dk!news.uni-c.dk!sunic!trane.uninett.no!nac.no!ifi.uio.no!nntp!alfh From: alfh@byleist.ifi.uio.no (Alf-Ivar Holm) Newsgroups: comp.lang.beta Subject: Re: Pattern variables Date: 14 Feb 1995 11:10:37 GMT Organization: Dept. of Informatics, University of Oslo, Norway Lines: 47 Message-ID: References: NNTP-Posting-Host: byleist.ifi.uio.no In-reply-to: agesen@Xenon.Stanford.EDU's message of 11 Feb 95 23:02:06 GMT CC: In article agesen@Xenon.Stanford.EDU (Ole Agesen) writes: In article agesen@Xenon.Stanford.EDU (Ole Agesen) writes: > Regarding the specific example, I don't think any one construct is > THE thing to use. Perhaps if your functions were more complicated than > just x+x and x*x, perhaps if they had state, perhaps if it was a more > complicated operator than simple composition, maybe one that evaluted > the functions several times, perhaps then one or the other > representation would be "better". > > What does "better" mean here? Or more generally why is it necessary > (or rather desirable) to have pattern variables in Beta? Can't we > just always use dynamic object references, say? > > Yes, probably. But then we could also "just" program Turing machines. > When designing a language, an important goal is to be able to express > direct, extensible, maintainable, concise solutions to problems and at > the same time avoid having a large complicated language. > Orthogonal concepts and few restrictions on how they can be combined is > the established way to achieve the goal. For example: > - We want static and dynamic references. > - We want references to patterns and to objects. > Now, should references to patterns be restricted to being static? > Of course not. I am not of the opinion of not wanting pattern variables in Beta. I just wanted to know if this particular example had some specific "property" that made dynamic pattern references more appropriate than dynamic object references. I do like Beta because it is a small (syntacticly), but expressive and powerful language. By swapping functions, procedures, and classes with patterns it has opened up new possibilities. There are a lot of ways to solve the same problem in Beta, which is a good thing, but it also urges the programmer to _think_ about the design of a program, to make it "good". "Structured programming" in OO-languages has a lot do to with mind set, since we are working on a higher level (than non-OO-languages). But, then again, I would guess that some language constructs are more appropriate than others for certain type of problems, and it is here that I am trying to fit pattern variables into this. (I just want to adopt a nice programming style in Beta, and it needs some thought (and experience).) Affi