According to the documentation eval
and eval-syntax
behave the same with the exception that eval
enriches the input syntax.
If top-level-form is a syntax object whose datum is not a compiled form, then its lexical information is enriched before it is sent to the evaluation handler:
Like eval, except that stx must be a syntax object, and its lexical context is not enriched before it is passed to the evaluation handler.
I am having a hard time understanding what this means. I get the impression that involves namespaces somehow, but I can't come up with an example program where eval and eval-syntax behave differently. (When given a syntax object.)
So how do eval
and eval-syntax
differ, or at least can you give me a sample program that shows them behaving differently?
(eval stx)
and(eval-sytnax stx)
without the ns argument. – Profluent