On Wed, Jul 27, 2011 at 8:38 PM, Anthony Grimes <disciplera...@gmail.com> wrote:
> Sorry for the terrible subject line. I couldn't think of an easy way to
> describe the problem in a single line.
> (def net (node/require "net"))
> (defn portal
>   [port host] (.createConnection net port host))
> (defn -main [& args] ; Note that only one of these -main functions is in the
> file at any given time, of course.
>   (.createConnection net 1337 "localhost"))
> (defn -main [& args]
>   (portal 1337 "localhost"))
> (set! *main-cli-fn* -main)
>
> For some reason, the first -main above works fine but the second doesn't.
> When I use the second and try to run it, I get this: TypeError: Cannot read
> property 'net' of undefined
> Why would my 'portal' function not be able to see 'net',

Caveat: I'm by no means a ClojureScript expert.

But maybe net is a private member of a class of which -main ends up a
method, somewhat like how gen-class works in plain Clojure, and so
-main can see it whereas portal, as a free-standing function, can't?

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