This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-06-25
Channels
- # admin-announcements (6)
- # beginners (38)
- # boot (65)
- # cider (22)
- # clojure (81)
- # clojure-berlin (15)
- # clojure-india (1)
- # clojure-norway (1)
- # clojure-russia (10)
- # clojure-sg (3)
- # clojurebridge (1)
- # clojurescript (94)
- # core-typed (44)
- # editors (6)
- # euroclojure (80)
- # events (7)
- # instaparse (9)
- # jobs (2)
- # ldnclj (14)
- # off-topic (8)
- # om (3)
- # reading-clojure (6)
@aengelberg: @dnolen: I started this section; nothing on ^boolean there yet: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#hinting
[:div {:class "navbar navbar-fixed-top"} [:div {:class "container-fluid"} [:div {:class "navbar-header"} [:a {:class "navbar-brand" :href "#"} "Photogallery"] [:div {:class "version"} "0.93"]]] [:button {:on-click #(do (println "click xxx") (om/set-state! owner :xxx [:table {} ; {:on-click (fn [] (js/alert "test"))} "asd" ;[:div {} ; [:table {} ; [:tr {} ; [:td {} ; "qwerty"]]]] ]))} "xxx"] (fn [] ;(html/render-html (om/get-state owner :xxx)) (when (not (nil? (om/get-state owner :xxx))) (om/get-state owner :xxx) ;(om/get-state owner :xxx) )) ]
I wrote a function which generates the html from us this vector and renders it afterwards component of om
everything worked OK until I tried to use the design (fn [] (when (not (nil? (om/get-state owner: xxx))) (html/html-render (om/get-state owner: xxx))))
per our discussions yesterday about :import
and Google Closure I found an error in an otherwise very nice ClojureScript resource: https://github.com/funcool/clojurescript-unraveled/issues/36
@a.espolov: formatted it for you
[:div {:class "navbar navbar-fixed-top"}
[:div {:class "container-fluid"}
[:div {:class "navbar-header"}
[:a {:class "navbar-brand" :href "#"} "Photogallery"]
[:div {:class "version"} "0.93"]]]
[:button {:on-click
#(do
(println "click xxx")
(om/set-state! owner :xxx
[:table {} {:on-click (fn [] (js/alert "test"))}
[:div {}
[:table {}
[:tr {}
[:td {}
"qwerty"]]]]]))}
"xxx"]
(fn []
;(html/render-html (om/get-state owner :xxx))
(when (not (nil? (om/get-state owner :xxx)))
(om/get-state owner :xxx)
;(om/get-state owner :xxx)
))]
anyone using figwheel? I'm having trouble using :on-jsload
in project.clj
. It doesn't trigger given function when I change some file. 😕
interestingly, all of these forms "work", but I suspect that the last one is meant to be idiomatic:
[:p "goog.global.COMPILED " goog.global.COMPILED]
[:p "goog/global.COMPILED " goog/global.COMPILED]
[:p "(.-COMPILED goog/global) " (.-COMPILED goog/global)]
goog is a namespace, global is an object attached to that namespace, COMPILED is an attribute of the global object
another interesting thing is that I can't find any mention on the wiki of the fact that "ClojureScript has a special syntax for access to the entire platform environment through the js/ special namespace. " http://funcool.github.io/clojurescript-unraveled/#access-to-the-platform Might be so simple that it's taken for granted but on the other hand it seems worth pointing out.
@dnolen: hmm. okay. Is one form preferred? I like goog/global.COMPILED
but I'm also trying to break myself of OOP idioms.
pkobrien: surprised about js/foo
not being documented, I would double check to be sure.
well, on this page there is only one example that uses the js
namespace, but no mention that the namespace exists or what it is for: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#host-interop
Hello, is there anything known, that Chrome is not working with the austin browser repl? When I run it, every operation hangs. After trying firefox, they are working as expected. 😩
@dnolen: when you say "no preferred thing in this case" do you mean the case of the Google Closure namespace? And that otherwise the rules defined for Host Interop on the wiki are meant to be the standard? https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure#host-interop
@roberto: thanks. I need to spend more time there. Found their link to js/
https://github.com/cljsinfo/api-refs/blob/catalog/refs/syntax_js-ns.md
hmm, this also works: js/window.Infinity
(no, really, I'm not confused by this at all...)
js/
references the global namespace, or window
. Window has a circular self-reference. So: window.window === window
in JS. So (= js/window.window js/window)
I just find it confusing when I read something like the Host Interop section of the wiki that states:
To access object properties (including functions that you want as a value, rather than to execute) use a leading hyphen:
(.-Infinity js/window)
=> Infinity
I'm still learning but I'll get there eventually. @teslanick: that part I have no problem with - it's only the syntax that's throwing me off at the moment
@teslanick: true. I'm just starting with what is on the wiki and trying to understand the syntax rules for cljs.
so I'm not at all confused by what is represented by js, window, global, or how they might differ on different target platforms, or references to the exact same object on browser platforms, etc. That part is pure fun and I'm reading the Google Closure book and going through the closure source code.
I'm just getting tripped up on making use of all the Google Closure goodies from within cljs and trying to do it in an idiomatic fashion while also learning clojure and clojurescript at the same time.
@meow: FWIW, ClojureScript: Up and Running has a section covering the special js
namespace.
@mfikes: Thanks. I just thought maybe it was worth mentioning its existence on the wiki somewhere.
@meow: Yes. IMHO, the wiki should contain a comprehensive normative description of ClojureScript.
@mfikes: I'd be happy to read/review/test/edit such a thing if someone were to write it.
I happen to think that ClojureScript is going to gain in popularity quite rapidly, quite soon, and may overtake (or at least catch up to) languages like Python. That means more programmers will be coming to it without previous exposure to Clojure and some without exposure to Javascript.
Coming from python (which I chose over perl, which was way more popular at that time around 1999) I'm a fan of having "one and only one right way" for things.
@meow: Best I can tell, the “Differences from Clojure” wiki page most nearly plays the role of being a language specification.
@mfikes: I agree. But the structure is cumbersome as a reference because you have to refer to the Clojure page.
@meow: Yeah. I've been wondering if a ClojureScript copy of the Clojure specification pages would be better.
And nowhere is there a good description of the host environment and its impact on the global namespace. By that I mean that values in the global namespace like NaN
, Infinity
, -Infinity
, +Infinity
, and the js
and Math
namespaces are a result of being hosted on JavaScript. And yet there is hardly a mention of them. This isn't necessarily a big deal, but it wouldn't hurt to explicitly describe what you get when you work in cljs, IMHO.
I recently did a bunch of work in QML, which is also a hosted language on JavaScript with the same things in their namespace because its part of the ECMA standard thingie. So I'm familiar with it.
@mfikes: I think it would be nice and useful to be able to go to a single page that captures everything to do with the ClojureScript spec without having to refer back to a Clojure spec. This might be a duplication of information but while I'm working in cljs as a newbie its been a struggle to pull together all the bits and pieces of information.
@meow: Maybe it could be multi-page and roughly of the same structure and content as the Clojure spec.
I think the only thing I've seed David comment on regarding this is the idea of it being a freely-editable wiki scales well for where we are now with the language.
Every time we discover some undocumented aspect of ClojureScript (like the js
nsmespace) a few sentences or paragraphs could be added to the spec by the community.
@mfikes: Why not just create a single page to get things started and then if any section becomes too big we can split it off into a separate page?
I don't want to create a tutorial or api reference - those already exist elsewhere. We just need an overview with a few examples to illustrate the concepts.
A cljs version of what's on this page would be nice: http://clojure.org/jvm_hosted
I'd like to at least deal with: importing, namespaces, notation (dotted member access), importing of Classes and implicit class constructors, the global namespace, whether or not the Math/ namespace has any value, and the Google Closure namespaces/classes/objects/attributes and how they represent exceptions to the general rules.
Even if you skim through http://clojure.org/data_structures you can envision a similar page that is accurate for ClojureScript.
I'm completely confused by this:
Library API
The "Library API" is an index of the symbols you can use inside any ClojureScript application.
These symbols span multiple sources, which you don't really need to know (see table below). We omit Google Closure* and JavaScript** symbols from this API reference, though they are included in and accessible from every ClojureScript application.
Google Closure Library
JavaScript's native library
My understanding is that there are no symbols from Google Closure that are included in and accessible. Not without specific imports, just like any other external namespace.
It's just that the Google Closure library is "bundled" as part of the compilation process, but no symbols are available within the global namespace of a ClojureScript application, right?
pkobrien: yes -- in other words, it's there to be :required or :imported without needing to add a lib ref
Google Closure is bundled, making it easy to import and use in your app. There is a js/ namespace that provides access to the JavaScript host environment. Beyond that, there are no symbols from either of these that are "included in and accessible".
I just read the guide being given away by @bostonou on his http://clojurescriptmadeeasy.com/ and wanted to say that it was very well written and worthwhile. Anyone working with cljs and core.async is likely to get something of value out of it. Good job!
I'm looking to use the clojurescript compiler from clojure to compile small cljs scripts. I'm digging through the documentaiton but can anybody point in the right direction?