This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-16
Channels
- # admin-announcements (14)
- # announcements (1)
- # aws (1)
- # beginners (105)
- # boot (609)
- # braid-chat (4)
- # braveandtrue (3)
- # cider (24)
- # cljs-dev (13)
- # cljsrn (2)
- # clojure (142)
- # clojure-berlin (7)
- # clojure-ireland (7)
- # clojure-japan (10)
- # clojure-nl (4)
- # clojure-poland (76)
- # clojure-russia (198)
- # clojure-sg (4)
- # clojure-taiwan (1)
- # clojurebridge (1)
- # clojured (4)
- # clojurescript (73)
- # conf-proposals (11)
- # cursive (10)
- # datomic (32)
- # devcards (1)
- # dirac (22)
- # editors (5)
- # emacs (3)
- # events (4)
- # funcool (19)
- # hoplon (18)
- # job (1)
- # jobs (3)
- # jobs-rus (16)
- # keechma (25)
- # ldnclj (33)
- # lein-figwheel (10)
- # leiningen (4)
- # luminus (1)
- # off-topic (19)
- # om (255)
- # onyx (51)
- # overtone (1)
- # parinfer (206)
- # perun (5)
- # proton (2)
- # re-frame (3)
- # reagent (2)
- # remote-jobs (13)
- # ring-swagger (7)
- # slack-help (4)
- # yada (7)
is it possible to compile a self-contained js snippet from a clojurescript snippet in the browser? i would like to make a collaborative coding environment with an iframe’d output window like codepen or jsbin. i feel like the best way would be to have a fully self-sufficient string of js that i just inject into an iframe. there are other ways around this if it’s not possible, though.
right now i have something that will translate (println "hey”)
to cljs.core.println.call(null,"hey”);
but obviously cljs.core.println is not defined within this output.
oh wow, i see there is a lot of discussion in this channel of similar things not too long ago. apologies if this question is redundant
oh, cool
I never used the search function before
So I'm taking a look at silk right now for routing, and I think it looks like a better, more flexible solution than secretary. Has anyone else found that to be the case? or would you recommend something else? https://github.com/DomKM/silk https://github.com/gf3/secretary
Actually, bidi looks good, too: https://github.com/juxt/bidi
I think I'm going to go with bidi. Looks relatively simple and it will fit all of my needs
@akjetma: Type (println "hey”)
into the Compilation box at http://swannodette.github.io/2015/07/29/clojurescript-17/ and you’ll see that cljs.core.println.call(null,"hey”);
is dropped into the box on the right.
@akjetma: If you want to be able to evaluate it, just look at how some of the online REPLs like http://clojurescript.io are built.
Oh, wonderful! thank you I will take a look at this. I am looking for output that includes the definition of, e.g. cljs.core.println
but this might be the wrong way to go about it
I suppose http://clojurescript.io is a bad example—it doesn’t appear to have print output hooked up. But http://clojurescript.net does.
@akjetma: If you evaluate js/cljs.core.println
in those two online REPLs you will see the JavaScript. http://clojurescript.io employs :simple
and http://clojurescript.net employs :none
ahh, yeah, so the problem i’m running into is: if i want to have a sandboxed environment (iframe with a separate window from the context in which the clojurescript is compiled) to evaluate the compiled clojurescript, i need to have all of the core functionality of clojurescript available to both sections. i am thinking i will split the code-writing/compiling section and iframe/sandbox section into closure modules and they can both have the common/core parts of clojurescript in a tertiary script.
thank you for pointing out that dnolen post and the js/cljs.core.println bit though, that is very helpful
@akjetma: Yeah, what you are describing sounds doable. Just up to your imagination and how you want to implement something like that.
@akjetma: I’ve also pondered if it is possible to produce a compiler that is built with :advanced
(to keep it small), but then evaluate the generated JavaScript in an environment that has the standard library JavaScript generated using :none
. (Not really what you are doing, but I was wondering about that nonetheless.)
Is it possible to get any information about what is defined in various namespaces in a repl context in cljs? Like ns-interns
in jvm Clojure ideally but interested in any ways this may be possible.
What is the best way to package a javascript library inside the clojurescript one? I'd like to avoid the situation where people have to install the js lib separately to be able to use my cljs lib
http://cljsjs.github.io is a good starting point
@nxqd: Look into goog.dom.fx.Scroll, worked great for me the other day
@nullptr: Thanks, will check out their docs
Has anyone used JSPM with ClojureScript. Looks to me like a nice, easy way to use :foreign-libs, using SystemJS to do the heavy lifting, then just ES6 imports from there...
@roberto: with secretary, I couldn't find a way to pass in anything custom to my route handler. For example, I might want to pass in some service to all of my route handlers. With silk or bidi, this is easy, since they just translate the (partial) URL to a handler or whatever data you want and then it is up to you to actually call the handler.
@roberto Keechma has a pure data processing based router http://keechma.com/api/keechma.router.html so that might work for you too
@mihaelkonjevic: I was actually the one looking for the router. Thanks for the suggestion
@kmandrup: there are the :language-in
and :language-out
compiler options (https://github.com/clojure/clojurescript/wiki/Compiler-Options#language-in-and-language-out). The description in the wiki is outdated, meaning you can also set :language-in
to :ecmascript6
. Will update them in a bit.
Nice to see you here @maria I'm just curious how to interop with popular modern JS frameworks, where many now leverage new ES6 syntax...
@kmandrup: no, I don’t think so, since all the code that the ClojureScript compiler generates is ES3 compatible
@kmandrup: not sure what advantage that would offer you … ES6 classes are mostly about syntactical sugar over existing functionality
there's very little reason to support any ES6 syntactical feature in ClojureScript at this time
I understand that, just simplifies not having to "reverse engineer"... say I'd like to integrate with Angular, Aurelia, Ember or whatever... all requiring ES6.
Just curious if I have to work with prototype
directly... what about getters/setters and all the other "magic spells" of ES6, would that still be simple in CS?
another advantage of Closure Compiler is you can write whatever bits of JS you actually need and compile it all together
Sure, I watched @maria presentation on compiler internals... but not sure where I would "write whatever bits of JS you actually need"? except by direct compiler extension/integration?
Sure, but that's what I was hoping to avoid. The whole point... escaping mutability hell while writing and leveraging ES6 code and not having to use Immutable.js etc.
why does ClojureScript need sugar for making mutable classes when you can just write them directly?
Just trying to avoid having to reverse engineer latest libraries/frameworks to ES5, such as: http://stackoverflow.com/questions/32028553/aurelia-computed-properties-with-es5
I get the general gist, I'd have to find ES5 or ES3 equivalent syntax to achieve the same functionality and then wrap it with CS macros? Thanks
ClojureScript avoided all class sugar in the past because there wasn’t a standard way to create “classes” in JavaScript just various competing patterns
ES2015 class sugar will eventually dominate but I don’t think we’re really there yet especially since most MVC frameworks are just fundamentally incompatible with ClojureScript wrt. mutability
a vast majority of ClojureScript people use React which doesn’t have these problems and doesn’t really require ES6 classes in any deep way
eventually the demand for other ES6 stuff may be great enough to desire some kind of defclass
patch, but I would say we are not there yet
I see your valid points Thanks for your time, I know you must be busy! I'm trying to write a book on native app dev with ClojureScript while learning it... since most of the resources in the wild seem to be out dated and don't delve into using React Native, Ambly, Electron etc.
Yeah, exactly my point. Since React still support the old ES5 syntax I'm also exploring reagent and om.next for the same reason! Cheers I owe you a beer!!
I also much prefer the pure functional/reactive approach of React, my questions were more "on principle"
No worries, was just curious what was currently possible. Would be nice to meet up in a pub in Brooklyn sometime... Cheers!
For experimental support (fork?) of select ES6 constructs, couldn't we make the compiler's Emission step optionally be configured to perform an additional transformation step (such as running through a transpiler), then have class
, extends
etc. "fall through" and be transpiled to ES5?