I got this oddity while debugging a Clojure sourcefile today:

user=> <right click "load file" in netbeans>
#<CompilerException java.lang.IllegalArgumentException: Parameter
declaration loop should be a vector (io.clj:55)>
user=>

Huh? Line 55 is a blank line!

user=> <right click "load file" in netbeans again>
#<CompilerException java.lang.IllegalArgumentException: Parameter
declaration loop should be a vector (io.clj:65)>
user=>  <and again>
#<CompilerException java.lang.IllegalArgumentException: Parameter
declaration loop should be a vector (io.clj:76)>
user=>

The line number is changing every time and every line is innocuous
(though only the first time was it actually blank). No unmatched
delimiters that could be derailing the parser.

So I manually check every occurrence of "loop" (ok, helped a bit by
isearch) but every one of them has a vector of bindings. Every one of
those is empty (they're all loops that sleep and wait on an external
condition, used where a C or Java programmer would have used while
(true)) but that's supposed to be legal.

user=> (loop [] 1)
1
user=>

And apparently it still is.

So I decide to check everything ELSE that requires vectors, starting
with defn and defn- arglists and planning to move on to let bindings,
fn arglists, and such.

I promptly find three defn- forms for no-argument functions with no
arglists and fix them by adding empty arglists. The file then compiles
successfully.

None of them were anywhere near any of the line numbers I got in the
error messages.

The error messages appear to contain two errors, then:

1. They specify a loop lacks a vector when it's a defn lacking a
vector that caused them.

2. The line numbers specified are not only not in general the actual
location of the error in the source file, they aren't even a
deterministic function of the input file and its dependencies.

If the Clojure compiler were implemented in C I'd suspect an
uninitialized automatic variable in the routine used to generate that
particular error message. In Java (or Clojure itself!) this simply
shouldn't happen. I'm mystified as to what could be causing this.

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