Thanks David. I think I'll implement this the way it should work then, and users will see an unresolved symbol warning if they use the incorrect forms. As things get fancier I can provide some explanation and an intention to migrate the incorrect forms to the correct ones.
Hopefully this should be done sometime this week. It's looking pretty nice :-) On 10 June 2014 00:21, David Nolen <[email protected]> wrote: > On Sun, Jun 8, 2014 at 5:55 AM, Colin Fleming > <[email protected]> wrote: > > > > Hi all, > > > > I'm working on CLJS symbol resolution for Cursive. There are a lot of > corners where it's hard to figure out from the doc how they should work - > I've looked through the code but I'm not sure I've got it all right. > > > > I've seen several times in the group here that / should only be used for > CLJS namespaces, never for JS properties. So (Array/isArray ...) should be > (js/Array.isArray ...) instead. Is this correct? ClojureScript: Up and > running states that / can be used for JS module objects, which I take to > mean root-level objects - their example is (Raphael/color....) from the > Raphael JS library. Their discussion of the differences in this-binding is > confusing since it seems that / should be used for JS but only in the case > of top-level objects. > > This is correct. / in ClojureScript should only be used for > namespaces. Any place this isn't the case that isn't one of the > exceptional cases in ClojureScript should be considered an oversight. > > > confirm-ns in analyzer.clj contains a list of namespaces which should > not warn, i.e. which are implicitly required, as I understand it > (cljs.core, goog, Math, goog.string). CLJS itself contains examples like > (Math/floor...) - does this mean that JS module objects are considered > namespaces? Is this true of provide'd Google Closure namespaces (e.g. > goog.string, which is also used like this in the CLJS source)? > > It's probably worth making an exception for Math for code portability > reasons. The others are proper namespaces. ClojureScript doesn't know > anything about "JS Modules". If a JS library is not required as a > namespace then it should be accessed in the standard way, no /. > > > Using e.g. :include-macros, it's possible to have the same alias refer > both to a CLJS and CLJ namespace simultaneously. I'm assuming that in this > case, if a symbol name were to conflict, that the macro form would take > precedence in the head of a list (since macroexpansion happens before > evaluation) but the CLJS form would take precedence everywhere else. Is > this correct? > > That's correct and it's actually something we take advantage of to do > inlining arithmetic functions etc. > > > I'm assuming that my-namespace.cljs does not implicitly refer macros > from my-namespace.clj - is this correct? > > That is correct. > > David > > -- > 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. > -- 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.
