On 24.03.2009, at 19:29, mikel wrote:

> I personally like Haskell's philosophy in this area: there is a
> facility for defining data layouts, and there is a facility for
> defining protocols, and they are completely separate. You can define a

I like that as well, and I have been trying to do something similar  
in Clojure with my types module (clojure.contrib.types) and my  
collection of generic interfaces (clojure.contrib.generic). It's too  
early to say if these will work out well, but I do think they are as  
close to Haskell's philosophy as possible in a dynamically typed  
language.

I haven't thought much about extending types yet. It could mean  
opening the can of worms associated with inheritance and all that. I  
am waiting for a concrete situation where extension would be useful  
to think about how best to do it.

> Clojure's built-in defstruct provides a way to specify record types,
> but not to extend them.

It is not really meant to define types, the documentation clearly  
says that struct maps are just an implementation of maps optimized  
for a specific frequent use case.

> (I have found Clojure MultiFns awkward to use thus far, especially
> when trying to design extensible APIs around them; client code has to
> know too much about the implementation details of MultiFns--e.g. you
> have to know when and how to hand-tweak dispatching for the particular
> MultiFns you are given).

Could you elaborate a bit on this? I haven't met any major obstacles  
with multimethods yet. The dispatch functions give quite a lot of  
flexibility in practice. In what situation did you find them  
inconvenient?

Konrad.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to