>
> In ClojureScript any namespace not enumerated in an explicit :entries will
> get moved into the base (common/shared) module. But this isn't as bad as it
> sounds because Google Closure supports cross module code motion at the
> function and method level. That is any code (even a single function) in the
> base module only used by some dependent module will get moved into only that
> dependent module.
>
@David: That is not ideal. Yes, the compiler will move code but some code it
cannot move. You must be very explicit with which files go where. Suppose this
example:
(ns my-app.common)
---
(ns my-app.helper)
(defn i-call-myself [] ...)
(i-call-myself)
---
(ns my-app.module-a
(:require [my-app.common] [my-app.helper]))
I define module common with entry #{'my-app.common} and module-a as
#{'my-app.module-a}, if I understand your code correctly you'll end up with a
base module that consists of my-app.common and my-app.helper. Then module-a
that only contains my-app.module-a since I only specified that. The helper
should be in module-a only, but since it has code that is executed the compiler
cannot move it.
You must take care of this when feeding the inputs to the compiler.
Closure Modules are great but require a bit of handholding to perform correctly
since the only reason you are doing it in the first place is to optimize file
size. If you leave too much to the compiler the size won't be ideal for _some_
programs. Trivial examples are very easy, actual production code will have a
ton of those gotchas. I speak from experience here. ;)
Hope that made sense.
/thomas
--
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.