The syntax for defrecord literals and tagged literals is very similar.

user> (defrecord x [y])
user.x
user> #user.x[3]
#user.x{:y 3}
user> #user.x [3]
RuntimeException Unreadable constructor form starting with "#user.x " 
 clojure.lang.Util.runtimeException (Util.java:170)

[3]

Basically the difference is tagged literals have a space between the tag 
and the clojure data.

What are the reasons for this difference? Is there an advantage? To me it 
seems too similar that it could be a source of bugs in code.

My pro/con breakdown:
Pro
-Separate "namespace", we can have tags that have the same name as a 
classname.
Cons
-Source of compile time bugs when only one is defined. Source of runtime 
bugs if both the tag and class exist.
-more work for parsers

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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