PS. The relevant part of Compiler.java is the emitValue method of
ObjExpr (or grep for readStringMethod -- I believe this is its only
use in the compiler).


On 30 January 2013 23:59, Michał Marczyk <michal.marc...@gmail.com> wrote:
> On 30 January 2013 23:32, Chas Emerick <c...@cemerick.com> wrote:
>> On Jan 30, 2013, at 12:23 PM, Michael Fogus wrote:
>>
>>>> RuntimeException EvalReader not allowed when *read-eval* is false.
>>>
>>> The problem is that the second eval gets (<the actual + function> 1 2
>>> 3) which invokes the right pathway triggering the exception.  You can
>>> trigger the same exception by:
>>>
>>> (binding [*read-eval* false] (eval (list + 1 2 3)))
>>
>> Re-reading this, I'm clearly not grokking something here.  Maybe I'm having 
>> a slow afternoon; send help. :-P
>>
>> This obviously ends up running through EvalReader — but why?  How is 
>> LispReader ever involved at all?
>
> I believe the story goes like so:
>
> The eval call here compiles a list of a function object and three
> numbers. The function object gets compiled to code which effectively
> calls readString on "#=(clojure.core$_PLUS_. )". (It so happens that
> print-dup knows how to handle functions; if it didn't, an exception
> would be thrown during compilation with the message "Can't embed
> object in code, maybe print-dup not defined: ...".) When the compiled
> code is executed, readString gets called to reconstruct the function,
> and since *read-eval* is false, this fails.
>
> +1 to setting *read-eval* to false by default, by the way.
>
> Cheers,
> Michał
>
>>
>> Thanks,
>>
>> - Chas
>>
>> --
>> --
>> 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/groups/opt_out.
>>
>>

-- 
-- 
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/groups/opt_out.


Reply via email to