Path: news.daimi.aau.dk!news.uni-c.dk!sunic!sunic.sunet.se!newsfeed.tip.net!news.seinf.abb.se!eua.ericsson.se!erinews.ericsson.se!cnn.exu.ericsson.se!convex!news.duke.edu!news.mathworks.com!gatech!howland.reston.ans.net!Germany.EU.net!news.dfn.de!gina.zfn.uni-bremen.de!marvin.pc-labor.uni-bremen.de!news.uni-stuttgart.de!news.belwue.de!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: 26 Jul 95 12:59:32 GMT Lines: 99 Message-ID: References: <3ulin4$h07@rs18.hrz.th-darmstadt.de> <3uvr75$5e3@belfort.daimi.aau.dk> <3v5451$12j2@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: >void Window::create() { open(); inner(); close(); }: >'inner' is defined by subclasses of Window. >The only thing that is different to BETA, is that you need a new >name for 'inner' in the Window-subclasses (Thanks to Daniel May >for pointing this out). But it works alright. With most languages, you can emulate one construct from the one language with a few constructs from the other language. It is true, that C's constructors and destructors can be used similiary to BETA's do-part. But they can also be used very differently. 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. You need to define just one pattern to modell that behaviour in BETA as well: overrideablemethod: (# override:< BooleanValue do (if not override then INNER if) #); myclass: (# (* virtual declaration *) virt1:< overrideablemethod (# ... do ... INNER ... #) #); mysubclass: (# (* extension of virtual *) virt1::< (# ... do ... INNER ... #) #); mysubsubclass: (# (* oops, we need to override the virtual *) virt1::< (# override::< (# do ... INNER ... ; true->value #) #); #); The result is, that if you execute mysubclass.virt1, only the code provided in the override section is executed, none else. My experience is, that you have to get used to the BETA concept. In the beginning, you may need the overrideablemethod stuff quite often, and it may be even worthwhile to declare any of your methods as overrideablemethod. But while you get experience in BETA, you will need it less and less often. >I am not convinced. You did not adress the issue, when I want to >specialize a pattern which has no inner inside. 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. >Thus, a common need for overriding has vanished, but the question >remains how to specialize patterns, that do not provide an 'inner'. >Or maybe the 'inner' is at the wrong place for your purposes? >Or different subpatterns need the inner at different places? >Im still puzzled. If you foresee, that you need more than one inner, you use the same solution, that you already suggested for use with C++: virtual methods. An example: myclass (# virt1:< (# inner1, inner2, inner3:< Object do ... inner1 ... inner2 ... inner3 #); #); mysubclass1: (# virt1:: (# inner1::< (# do ... #) #) #); mysubclass2: (# virt2:: (# inner2::< (# do ... #) #) #); and so on. 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 |