Method-dispatch
Francois-Rene Rideau
fare@tunes.org
Fri, 3 Dec 1999 23:55:32 +0100
On Fri, Dec 03, 1999 at 01:13:14PM +0100, Stig Erik Sandoe wrote:
> ... (deftype a-or-b () '(or a b)) ...
Ok, so you want union types.
They have been extensively studied in CS literature.
In a CLOS-like setting, they can be directly expressed
with multiple-inheritance, all the more since CLOS allows
dynamic modification of classes.
> I solved the specific problem with a macro and the savings in code
> are pretty good.
Good.
> The solution just solves my problem however and a
> more complete implementation would be interesting.
When would you consider it complete?
> However the example does imho show that more powerful
> mechanisms are needed when
> doing dispatch (and esp in languages with multi-dispatch).
> Currently, all languages I know is based on specialising on
> individual types/classes and not sets. Being able to specify various
> type-sets to dispatch on would probably allow an even more
> expressive language and that is a Good Thing (tm).
If the mechanism to describe sets becomes as "complete" as computationally
possible, you get a full programming language at the type level.
Another problem you get is prioritization of rewrite rules in your system,
and you also end up having a full language at the meta-level.
For a language with a Turing-equivalent type system,
I recommend that you look at Cayenne, which is a Haskell extension,
and to Kris de Volder's PhD thesis on Type-Oriented Metaprogramming
(if you can find it on his site, please post a URL!)
http://www.md.chalmers.se/~augustss/cayenne/
http://progwww.vub.ac.be/kris/
In the end, I believe the Right Thing(tm) would be some kind
of reflective expert system, perhaps much like Pitrat's MACISTE.
Regards,
[ "Faré" | VN: Уng-Vû Bân | Join the TUNES project! http://www.tunes.org/ ]
[ FR: François-René Rideau | TUNES is a Useful, Nevertheless Expedient System ]
[ Reflection&Cybernethics | Project for a Free Reflective Computing System ]
Disraeli was pretty close: actually, there are Lies, Damn lies, Statistics,
Benchmarks, and Delivery dates.