Clojure Protocols & expression problem
bearophile
bearophileHUGS at lycos.com
Wed Apr 28 04:49:46 PDT 2010
A short video about Clojure 1.2 Protocols, created to solve the expression problem (that D doesn't solve well yet), they are like fake multimetods because they are like single dispatch :-) (So they need just a virtual table, that the JavaVM can optimize well):
http://vimeo.com/11236603
By the way, you can see an example of the expression problem here, this is D code that solves one case of it:
http://codepad.org/RPw6Kxu6
This is the same in Python with the multimethod (module inlined at the top), it's similar to CLisp CLOS solution:
http://codepad.org/tWsYomoZ
Bye,
bearophile
More information about the Digitalmars-d
mailing list