- about OOF

From: ForthCAD <mail_at_forthcad.com>
Date: Sat, 23 Jan 1999 13:19:07 -0800

About OOF

Thanks to all who have answered my question about OOF.

I have found the Wil Baden' proposal. Its only a description of a class wordset, with only a few details about implementation nor virtual functions...

I have just terminated a first alfa release of such a compatible object-oriented programming system. ( with a very small overhead on normal Forth words, and a definition for 'virtual' word - very important in Windows programing ! )

Anybody interested can call me to have the source file. ( 500 line, 6 kbyte in SwiftForth )

For those who are interested, here is the Wil Baden Class wordset: (the same used in my OOF system)

Also any ideas on improvements to the code or documentation will be welcome...

============ANSI Class wordset proposal=============

CLASS
    CLASS class
    Construct a class.
    A class is a defining word for a collection of future definitions.

VARIABLE WITHIN A CLASS
    VARIABLE membername
    Define a variable member of a class.

BUFFER: WITHIN A CLASS
    n CHARS BUFFER: membername
    n CELLS BUFFER: membername
    Define a data area member of a class.

CONSTANT WITHIN A CLASS
    n CONSTANT membername
    Define a constant member of a class.

: WITHIN A CLASS
    : membername ... ;
    Define a function member of a class.

; WITHIN A CLASS
    : membername ... ;
    Terminate the definition of a function member of a class.

END WITHIN A CLASS
    END
    Terminate the construction of a class.

BUILD
    class BUILD objectname
    Build object objectname as an instance of class .
    Objects are used object member .

COMMON WITHIN A CLASS
    COMMON forthword
    Compile forthword from standard dictionary.

SUPER WITHIN A CLASS
    SUPER member
    Compile a member, beginning lookup for it in the superclass.
    This disambiguates members with the same name.

SUBCLASS
    class SUBCLASS classname
    Construct an extension or specialization of a class.

============My extension in the above worset=============

PUBLIC WITHIN A CLASS
    PUBLIC ( -- )
    Declare a public section in the class.

PRIVATE WITHIN A CLASS
    PRIVATE ( -- )
    Declare a private section in the class.

VIRTUAL: WITHIN A CLASS
    VIRTUAL: member ... ;
    Define a virtual function member of a class.

NEW
    class NEW
    Allocate and returns a class-object pointer. (its the heap
    BUILD version)

RELEASE
    obj-ptr RELEASE
    Free the allocated memory.

-->
    obj-ptr --> method
    Execute the given method for obj-ptr. ( run-time binding )

CLASSDUMP
    class CLASSDUMP
    Display class informations.

SIZEOF
    class SIZEOF
    Returns the class data size.
_____________

Bureau d'Etudes Informatique MELICE SPRL
Zoning Industriel
B-5650 CHASTRES
Belgium

.
Received on Sat Jan 23 1999 - 13:19:07 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 06-Feb-2012. Archive updated nightly.