Path: news.daimi.aau.dk!news.uni-c.dk!sunic!sunic.sunet.se!mn6.swip.net!seunet!news2.swip.net!plug.news.pipex.net!pipex!tank.news.pipex.net!pipex!news.mathworks.com!fu-berlin.de!marie.physik.tu-berlin.DE!wpp From: wpp@marie.physik.tu-berlin.de (Kai Petzke) Newsgroups: comp.lang.beta Subject: Re: unusual inner Date: 28 Jul 95 10:23:28 GMT Lines: 120 Message-ID: References: <3ulin4$h07@rs18.hrz.th-darmstadt.de> <3uvr75$5e3@belfort.daimi.aau.dk> <3v5451$12j2@rs18.hrz.th-darmstadt.de> <3v7t9n$147f@rs18.hrz.th-darmstadt.de> NNTP-Posting-Host: marie.physik.tu-berlin.de (130.149.40.96) NNTP-Posting-User: wpp X-Access: 16 915 kuehne@sun46.isa.informatik.th-darmstadt.de (Thomas Kuehne) writes: >In article , wpp@marie.physik.tu-berlin.de (Kai Petzke) >writes: >> With most languages, you can emulate one construct from the one >> language with a few constructs from the other language. >Super calls aren't that easy to emulate in BETA, are they? >With 'Super calls' I mean the possibiltiy to override a method and >freely use the code of the old method in the new method. I have already explained, how overriding can be implemented. If you want to be also able to use the code of the old method, make sure, that you do not define your methods directly in the virtual declarations, as in: mypattern: (# meth1: overrideablemethod (# ... #); virt:< meth1 #); mysubpattern: (# meth2: meth1 (# ... #); virt::< meth2 #); mysubsubpattern: (# meth3: meth2 (# override:: (# ... true->value #) #); virt::< meth3 #); Then it is no problem to call meth1 and/or meth2 from meth3. >One way to achieve it in BETA might be to use component patterns, >that implement the code. Thus the new method could use the same >code components, that the overidden method does. >However, this looks awful to me. Why is it awfull? One of the great things about BETA (IMHO) is, that you can use a blocking structure for both types *and* code. To me, it has become very natural to move every do part, that is longer than a few lines, to its own pattern or item. >> If I understand you right, one point of your complaint was, that >> BETA lacks virtual methods, which can be completely redefined in >> a subclass, while C++ has them. >Yes and no. >That you can not overide is one problem. >The other problem is that you can not freely use the old code in the >new method. Yeah. At the current state of BETA, you have to pay attention, if you want to be able to later override or re-use code of the old method. Proposals on how to extent the BETA language to suit overriding and calls to the old code have been posted. Unfortunately, there has not yet been a final vote, on which version, if any, shall be implemented in future versions of the compiler. >> You need to define just one pattern >> to modell that behaviour in BETA as well: >> >> [ ... example deleted ...] >I feel very uneasy to simulate overriding with the help of a variable. >Is this recommended BETA style? At the moment, it is. Can you further explain, why you feel so uneasy about introducing a variable? >> I do not understand that problem, especially, when compared to C++. >> A pattern with a do-part but no INNER is like a method in C++. None >> of them can be further extended. >Yes, but C++ does the same "fault". >In Eiffel *any* method can be overridden by default, since >- in C++ speak - every method is virtual by default. >Therefore you only have to think about future uses, if you are sure >that noboday shall override your method (then you declare it as 'frozen'). Any language is a trade-off. BETA has a the very general pattern concept, but the trade-off is, that a distinction between patterns and virtual patterns have to be introduced. Normal patterns can be further extended by subclassing, while virtual patterns are extended by further virtual bindings. >Declaring every method 'virtual' by default in C++ seems more >reasonable than applying the 'overideable' scheme to a method >by default. Can we please keep the discussion to technical aspects? It is ok, that you have your feelings about things being "awfull" or "uneasy" to you. But please don't expect me or anyone else to share your opinion. What do you want? Would you like BETA, if it had the OUTER extension? Or do you prefer Eiffel/C++ anyways? >> If you foresee, that you need more than one inner, ... >Clairvoyance is really a problem in software engineering >(or in prototyping, if you want to restrict it to that). Yeah. Prototyping like any other software development goes through "compile - run - crash" cycles. Only, that the crashes in these cases are on the meta-level. You find out, that you have to re-work your design. Kai -- Kai Petzke | How fast can computers get? Technical University of Berlin | Berlin, Germany | Warp 9, of course, on Star Trek. wpp@marie.physik.tu-berlin.de |