On 22.01.2009, at 07:48, Mark Engelberg wrote:

> Is there any way to determine whether something is a "struct" (versus
> an ordinary hash map), and if so, determine which kind of struct it
> was built from?

Not that I know. I have been searching for a while, and ended up  
using my own tag attached to the struct as metadata. In clojure.zip  
there is a similar use of metadata: methods are implemented as  
functions passed in the metadata.

I am not entirely happy with this approach though. If everyone starts  
to use metadata for various purposes, such type tags may well  
disappear by some function replacing the metadata on an object  
without preserving the tags that are already there. This is all the  
more likely because there is nothing in the standard library to add a  
tag to an existing metadata map. All there is is (with-meta ...),  
which replaces the metadata map completely.

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