fasterthanlime / shin

:warning: (def shin (dissoc clojurescript :jvm :google_closure)) (deprecated)
MIT License
35 stars 1 forks source link

Proper module / namespacing #6

Closed fasterthanlime closed 9 years ago

fasterthanlime commented 9 years ago

E.g. ns form with :require, :use should translate into Node/AMD requires/define properly.

Also that would allow #4 and #5 which are very important.

fasterthanlime commented 9 years ago

Also pay attention to def, right now it just makes local variables. defn does so too but should be rewritten as a macro, see #5.

Also compiler should parse "required" files that are shin/clojurescript as well & be able to output them all in a directory & recompile only the changed ones when in watch mode.

fasterthanlime commented 9 years ago

Done most of the work on this, but this is harder than I thought.

:refer shouldn't be much of a problem, but :use (i.e. :refer :all) is more delicate. The only reason it works in ki, afaict, is that everything is thrown into the global scope. Which is fine for one-off test code, but not for the neatly-encapsulated things we want here.

I see two options:

The latter option does not particularly rejoice me: it'd mean hundreds of vars generated that it wouldn't necessarily use. Maybe uglifyjs would be able to reduce that, but who knows? Without doing some resolving on our side, we won't be able to eliminate most of those.