Hi Jonas

On Tue, Jan 3, 2012 at 2:43 PM, Jonas <jonas.enl...@gmail.com> wrote:
>
> 1. In order to be able to run your examples I have to comment out the
> clojure.test, clojure.stacktrace and clojure.template namespaces. Otherwise
> I get a NullPointerException[1] which I’m unable to track down. It seems to
> originate from the wall-hack function. What does this function do?
>

wall-hack allows me to access method/fields of private classes via
reflection. If there's a better way I'm all ears, but if I'm using
wall-hack it usually means the Class is private.

That being said, the stacktrace you're getting originates in the Compiler's
analysis phase. The call to wall-hack is a call to
clojure.lang.Compiler/analyze.

Be ready for some very cryptic errors :) It also helps to have a clone of
the clojure source to follow the stacktrace.

How are you running the code? Could you pull the latest master and try
again? Possibly track down exactly which namespace is causing the Exception.

(I just realized there's a public method of clojure.lang.Compiler/analyze,
so wall-hack is not necessary for calling clojure.lang.Compiler/analyze.
Just pushed the change.)


> 2. Is it possible to do some analysis before macroexpansion? For example,
> If I want to look for the pattern
>
>     (if (some-test? …)
>         (some-expr …)
>         nil)
>
> and print the following: “WARNING: consider using (when …) instead of (if
> test then nil)”. Is this possible since (when test expr) expands to (if
> test (do expr)). Maybe this kind of code analysis is outside the scope of
> your library?
>

This would be easy if the analyzer was more like ClojureScript's analyzer.
ie. written in Clojure with multimethods.

But I'm not sure how to do this otherwise. You'd basically want to add a
new special form that tells the analyzer to stop macroexpanding.

Basically, yes, this is outside the scope of what I hope to achieve right
now.

Thanks,
Ambrose

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