On Wed, Jul 27, 2011 at 9:48 PM, Anthony Grimes <disciplera...@gmail.com> wrote:
> Hah! That was it! You, sir, are one clever fellow. Thank you very much.

Damn. I didn't think of that. In normal Clojure, defn'ing x.y/x
doesn't clobber the Java package named x with a function named x. But
it looks like in JS packages and functions go into the same namespace,
so the defn shadows "portal" later on and "portal.net" looks for a
member "net" in the "portal" function object instead of the "portal"
namespace.

Another gotcha with ClojureScript vs. Clojure, where a function named
portal.core/portal would work fine.

The error message could clearly stand some improvement: it should
clearly identify the object it was trying to find something in.
Instead of "TypeError: Cannot read property 'net' of undefined" it
should have said "TypeError: Cannot read property 'net' of 'portal',
which is an object of type 'function'" or something. Then it would
have been clear it was looking inside the function object instead of a
namespace object for "net".

The fix for this may be quite simple: have the compiler generate code
to pass the function object instead of null as the first parameter
when it generates those ".call" calls. :P

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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