Hi Btsai, thank you for your offer for help.

As I said before I *could* use literals but it wouldn't be convenient.
I have a big structure which contains information about "types" (they
are types of domain-specific objects). I would like to extract the
"methods" I need from this structure and define them
programmatically.

Previous solutions to this problem (both by me and other helpful
posters) required to pass keywords as literals. While I could do that,
maintaining a separate list would be a hassle.
Right now I'm using:

(doseq [t (an-expession-which-extracts-a-list-of-keywords)]
  (eval `(defobjecttype ~t)))

So the problem is solved for me, although I have to use eval. I'm not
sure exactly how dirty this trick is and especially *why* it is
considered a "smell". I read it on Paul Graham's "On Lisp" and he
vehemently opposes its use but he doesn't explain why or where it is
acceptable. Note that he also considered Common Lisp "let*" a smell,
which is standard practice in Clojure (and in fact there's no
equivalent of Common Lisp "let"). So maybe we are just making too much
a big deal of this "eval" thing.

I feel however that this problem should be addressed by the macro
system somehow (although maybe that's not possible by design).
If someone could find a solution which doesn't involve eval it would
definitely be more elegant.

-- 
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