Hi Everyone, I'm new to ClojureScript, but I've been doing Clojure for a while, and this was something that's been catching me out a lot.
In Clojure, attempts to use an undefined var result in a compiler error, whereas in CLJS they are left to fail at runtime. Presumably this is to play nicely with the more dynamic JavaScript environment. However, because function calls expand to namespace.whatever.func.call(null, //... Then if i've typoed my function call or mixed something up somewhere, I get the rather cryptic TypeError: Cannot call method 'call' of undefined I'm finding this is especially awkward if i'm passing functions around or there's a few invocations on the same line, and it's not obvious which one of the function calls is actually the bad one. Is this something that happens less once you get used to ClojureScript? Are there some tricks I can do to avoid making these mistakes? Would it be possible to tweak the compiler to warn about undefined "var" usage? If compile-time warnings are too restrictive, would it be possible to have a compilation mode where i get something like safeCall(namespace.whatever.func, "namespace.whatever.func", // .... which can tell me what the invocation looked like that failed? I hope that makes sense! Cheers Glen -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
