[gephex-devel] subtyping in gephex-0.5
Georg Seidel
georg at gephex.org
Mon Nov 29 21:45:20 CET 2004
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The simplifications of the unit and link type system make
it possible to get a very cool thing working without
much work: subtyping of link types.
We can simply use the subtyping of c++.
Consider the following relation.
In the C++ implementation the respective classes
use inheritance to model it.
(LinkType and PackedImage are abstract base classes)
~ LinkType -> PackedImage -> PackedBGRAImage
~ |
~ -> PackedYUVImage
The only extra thing we would have to implement is to
tell the core about this subtype relation.
This could be done in the link type spec:
~ link PackedBGRAImage
~ {
~ basetype = "PackedImage"
~ author = "..."
~ version = "1.0"
~ [...]
~ }
While this is somewhat redundant to the inheritance
in C++ I do not see an easy way to avoid it.
I think that the extra complexity in the core would be
very small (maintain subtype relation, type check of
connection uses transitive closure).
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFBq4pg/rP0cdKF/ToRApYWAJ9KgQnhw6ykaZ+GO3pfmsbzYVgqAgCgxbJd
6RY3+HaklVVQOQkhVOjU8jI=
=5G4S
-----END PGP SIGNATURE-----
More information about the gephex-devel
mailing list