[plt-scheme] Polymorphic Structure Types
On Apr 21, Andre van Tonder wrote:
> [...]
Nice trick, but three coments...
> ; The built-in Mzscheme define-struct type allows single inheritance
> ; of structure types. However, many problems may be expressed very
> ; naturally in terms of structures that may have more than one
> ; supertype
1. Swindle did that for ages... (Sorry, but I couldn't resist, I know
that you know...) And it is not as heavyweight as it seems.
> ; (see e.g. how heavily interfaces are used in Java),
2. I think that this is not a good example -- the heavy use of
interfaces are due to a compromise where you can do multiple
inheritance as long as it doesn't involve new slots. This way they
can keep the type-casting thing and optimized access -- which is
one thing you lose when you check the type of an object when you
use redefined accessors.
3. Technical point -- your message had wrapped lines... Best to keep
code in short lines or use attachments...
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!