I guess js/goog.net.EventType and js/goog.net.XhrIo would have worked in those cases?
My issue in Cursive is that resolving any symbol to its JS equivalent (which would fix a lot of these cases I've asked about) caused a bunch of spurious resolutions. For example, in one of my tests I had a symbol 'f' that shouldn't resolve, however that was resolved to an 'f' defined somewhere in a Closure test case, i.e. any naked symbol 'f' would resolve to that. I subsequently disabled all indexing for *_test.js files so that case would no longer be an issue, but I'm still not sure if there would be others. I'm a little torn between implementing how it seems like it ought to work based on this discussion, and resolving how it actually currently works which will give false positives. On 23 June 2014 00:28, David Nolen <[email protected]> wrote: > Interop with Google Closure libraries creates some issues as they > don't really follow Clojure namespace conventions at all. I don't > really see how to disallow things like that without causing more > trouble than it's worth. Open to any good ideas others may have. > > David > > On Sun, Jun 22, 2014 at 2:59 PM, Colin Fleming > <[email protected]> wrote: > > And one more question - clojure.browser.net requires, amongst other > things, > > goog.net.EventType :as gnet-event-type and goog.net.XhrIo :as gxhrio. > Later, > > these are used as: > > > > (merge > > (js->clj goog.net.EventType)) > > > > and > > > > (extend-type goog.net.XhrIo > > ... > > > > Is this generally accepted, i.e. should requiring a constructor also make > > the constructor available via FQN? > > > > > > On 15 June 2014 01:38, Colin Fleming <[email protected]> > wrote: > >> > >> Ah, of course, that's automatically aliased - thanks! > >> > >> > >> On 15 June 2014 00:58, David Nolen <[email protected]> wrote: > >>> > >>> Those should be cljs.core/Foo > >>> > >>> David > >>> > >>> On Sat, Jun 14, 2014 at 6:27 AM, Colin Fleming > >>> <[email protected]> wrote: > >>> > One more question, I've seen things like this a couple of times: > >>> > > >>> > (instance? cljs.core.Delay x) > >>> > > >>> > and > >>> > > >>> > (set! cljs.core.ExceptionInfo.prototype (js/Error.)) > >>> > > >>> > Here the JS FQN doesn't use the js/ alias. Is that because instance? > >>> > and > >>> > set! are considered interop forms, or can fully qualified JS objects > be > >>> > referred to anywhere without the alias? > >>> > > >>> > > >>> > On 10 June 2014 01:37, Colin Fleming <[email protected]> > >>> > wrote: > >>> >> > >>> >> Great, thanks. > >>> >> > >>> >> > >>> >> On 10 June 2014 01:33, David Nolen <[email protected]> wrote: > >>> >>> > >>> >>> That is correct. > >>> >>> > >>> >>> On Mon, Jun 9, 2014 at 9:31 AM, Colin Fleming > >>> >>> <[email protected]> wrote: > >>> >>> > Oh, one other question - does :refer-clojure in CLJS refer both > >>> >>> > macros > >>> >>> > and > >>> >>> > functions in the same declaration? i.e. I could do something > like: > >>> >>> > > >>> >>> > (ns foo > >>> >>> > (:refer-clojure :only [defn reduce])) > >>> >>> > > >>> >>> > > >>> >>> > On 10 June 2014 01:27, Colin Fleming < > [email protected]> > >>> >>> > wrote: > >>> >>> >> > >>> >>> >> 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 > . > >>> >>> > >>> >>> -- > >>> >>> 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. > >>> > >>> -- > >>> 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. > > -- > 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.
