Path: news.daimi.aau.dk!olevi From: olevi@daimi.aau.dk (Ole Villumsen) Newsgroups: comp.lang.beta Subject: Re: Overriding procedural patterns Date: 5 May 1995 14:58:53 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 63 Message-ID: <3odefd$hbp@belfort.daimi.aau.dk> References: <3o315c$9he@pulm1.accessone.com> NNTP-Posting-Host: indium.daimi.aau.dk Baiss E. Magnusson writes: >I am troubled by the Beta definition that a virtual pattern can only be >extended and cannot be completely redefined. The complete over-riding of >the enclosing procedure pattern seems to me to be a fundamental need. The usual hack to achieve this goes like: super: (# virtual:< (# doneInInner: @Boolean; do inner; (if doneInInner//false then (* do it my way *) (* else do nothing *) if); #); #); sub: super (# virtual::< (# do (* do it my way *) true -> doneInInner; (* so super won't do it *) #); #); It only requires a little foresight when writing the super-pattern, of course. >My experience with object oriented applications is that one of the most >common uses of class hierarchies is the notion of a selected set of >items. An operation, for instance , is performed on that selected >set. The operation of drawing in a lower class will not use the same >drawing commands as the object in a super class. >Consider the following class hierarchies, all taken from real world >application programs: >1) Pre-press Application: Signature - Press sheet - Page - Page crop mark >2) CAD Application: Symbol - Irregular polygon - line >3) Word Processing Application: Page - Paragraph - word I'm not sure whether you mean that page is a kind of paragraph or the other way around. In any case, the BETA philosophy would be to try to model the world, so my class hierarchies wouldn't look like the above. I would use part objects instead: words are part of a paragraph. Redrawing the paragraph means sending redraw messages to each word. >In all cases the user selects a grouping of both higher and lower >objects, (i.e. a press sheet and a page ) and then moves the objects. The >first thing that is done is a "function message" is sent to every >object in the group to draw to an off screen map. Then the map is moved. >The draw function of the page will not do all the things that the draw >function of the press-sheet does. With part objects, it would work fine. You will want to have an abstract superclass for the (pressSheet and page) classes, with a pure virtual draw pattern (i.e., one that does nothing except call inner). >Is this not possible in Beta? It would be in Simula. Any of the above two methods would work. Personally, I'd prefer the latter. Ole