I've solved the problem. I found that it only occurred when general-
defmaker was called with its forms argument containing another general-
defmaker call with def-form being defmacro. Thus, in the inner general-
defmaker call, the *result* of (NamedRule. (delay …)) was embedded
into a defmacro call, resulting in the error.

The solution was to change
    (alter-var-root maker-var# named-rule-maker ~rule-type-kw)
to
    (when (= '~def-form `defmacro)
      (alter-var-root maker-var# named-rule-maker ~rule-type-kw))

Thanks, everyone for your help.

joshua-choi wrote:
> That ought to be correct, but I can't reconcile that with the error
> message. Doesn't the "Can't embed object in code, maybe print-dup not
> defined" error only appear in macros, when some object being spliced
> into a macro's expansion is not a basic Clojure form? Yet, you are
> correct, commenting out that function call in the macro does prevent
> the error. I don't understand it.
>
> Konrad Hinsen wrote:
> > On 10 Sep 2010, at 03:11, joshua-choi wrote:
> >
> > > And here is a full macro-expansion of the call at which the error
> > > happens:
> > >
> > > http://gist.github.com/572879
> >
> > If I understand the comment ("the following form is the culprit...")
> > correctly, it's not the macroexpansion that fails, but the evaluation
> > of the resulting expression. Is that correct? In that case, it's not
> > really a macro problem, but a problem with a complex use case of alter-
> > var-root.
> >
> > Konrad.

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