This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> We're going to implement an object system on top of the structs. When > we've replaced the structs, the object system can work on top of the > new representation. Why do you want to implement an object system on top of ("C") structures? An object is just a (expandable) set of "features", where a "feature" is either a state variable or code. An example from Meyer's OOSC: (define comparable (object () ; import from: no superclass (le minimum value); interface: we export 3 features ( ; le is deferred (minimum (lambda (other) (if (le other) value (other value)))) (value) ;abstract ))) Now the class "int-comparable" is derived from comparable and overrides le (position 1): (define int-comparable (object (comparable) (le minimum value) ( (le (lambda () (<= value (other value))))))) We can now use this concrete class "int-comparable" and create objects by sending it a message: (define i (int-comparable value 10)) (define j (int-comparable value 9)) (i minimum j) -> 9 I think an object is just a vector of name/value pairs, not a structure! Jost