Eval gets a bad reputation from languages like JS where it's messy and a
bit of a security risk. In Clojure, there's nothing wrong with using eval
for something like this.

On Tue, Nov 7, 2017 at 11:43 PM, Nick Mudge <n...@perfectabstractions.com>
wrote:

> I need to dynamically reify some java interfaces based on data from a
> map.  One way I can see to do this is to generate the reify code with a
> function using syntax quotes, quotes and unquote and unquote splice.  And
> then evaluate it using eval. I hesitate using eval, but is eval the right
> tool for this case?
>
> Normally I would write a macro to generate code. A macro is good for
> generating code from source code. But in this case the data that is used to
> generate the code is coming from a var that holds a data structure.
>
> Any thoughts about when it is okay/good to use eval in Clojure?
>
>
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to