On 25/06/2015 11:07, Marko Rauhamaa wrote:
Michael Tiedtke <michele.titke@o2online.de>:

Nice! What about (define-class <stack> (<list>) ...)? In GOOPS every
primitive type is (or should be) a class that can be used with
multiple inheritance. It's enough to (use-modules (oop goops)).
My "simpleton" doesn't have classes. It's *object* oriented, not *class*
oriented.

That reminds me of one chapter of Structure and Interpretation of Computer Programs:
Modularity, Objects, and State (https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-19.html#%_chap_3)
which comes right after Systems with Generic Operations.

My current references to step ahead and not get stuck include TinyCLOS. GOOPS is - according to the documentation - inspired by it. The nice thing about it is this: it's 886 lines of Scheme code in one file which can be distributed (see below).

For now I think I will do w/o message passing as GOOPS' define-class is one long letrec and of treating Scheme code as s-expressions with cdddrs. But with it's MOP / class system I can finally try to design an application framework with multiple inheritance.

RIght now I have three distinct classes plus a "flat" controller: <terminal>, <buffer-view>, <buffer> where buffer denotes a text file buffer because it's about a text editor. As the needed functionality and structure is building up I can already see <buffer-view> has to "shadow" a lot of the functionality from both <terminal> and <buffer> and it might turn out that it's hard to keep them synchronized. Let's take for example the generic cursor-up. The <terminal> is dumb and let's you call it as often as you want but it (the underlying VT) keeps the cursor on the screen. Now <buffer-view> needs a method cursor-up, too. It has to make sure it stays in the current region of the buffer on screen and it has to call cursor-up for <terminal> explicitly or scroll the content or beep etc.

With multiple inheritance it should be enough to call next-method at the right moment because any real programmable vi needs an incorporated Snake game (often called Nibbles) to remind people of Viper and the Virtual Terminal era and the Visual Display Editor.



TinyCLOS
; **********************************************************************
; Copyright (c) 1992 Xerox Corporation. 
; All Rights Reserved. 
;
; Use, reproduction, and preparation of derivative works are permitted.
; Any copy of this software or of any derivative work must include the
; above copyright notice of Xerox Corporation, this paragraph and the
; one after it.  Any distribution of this software or derivative works
; must comply with all applicable United States export control laws.
;
; This software is made available AS IS, and XEROX CORPORATION DISCLAIMS
; ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
; PURPOSE, AND NOTWITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY
; LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS
; EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING
; NEGLIGENCE) OR STRICT LIABILITY, EVEN IF XEROX CORPORATION IS ADVISED
; OF THE POSSIBILITY OF SUCH DAMAGES.
; **********************************************************************