Fork me on GitHub
#clojurescript
<
2016-10-17
>
shaun-mahood00:10:34

@netchkin: I got it to compile on both Mac and Windows, and I get the same error when trying to run it in Windows. Same thing if I compile in advanced mode. I think it’s got to be related to something specific that has to be done to get it to run in Node, it might be worth looking on the ClojureScript site for Node specific help. I don’t think there’s any issues with the ClojureScript compiler, Leiningen, or Reagent though - most likely just an extra bit of config or code that you have to put in to get it to work for that example.

nikki04:10:44

hey all--for learning cljs, what would you recommend? looking to get an overview of what things exist in the language so I know to use them when I can, i’ve programmed for a while mostly c, c++, javascript and have done a fair amount of lisp and haskell stuff

nikki04:10:01

i think getting an idea of what is new in cljs w.r.t those langs and the design ideas would be neat

nikki04:10:19

i was thinking to go through clojure-for-the-brave-and-true real fast then go over a clj -> cljs diff

jrheard04:10:39

@nikki - sounds like a good plan. consider also watching a few rich hickey talks, eg https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey and https://www.youtube.com/watch?v=-6BsiVyC1kM , for more information about design decisions in clj/s (i haven’t read brave-and-true, maybe it does a fine job of covering this stuff on its own)

jrheard04:10:06

the idea of starting with clj and moving to cljs once you’ve got a good handle on clj is definitely correct imo

jrheard04:10:55

editor-wise, intellij+cursive is great for both languages, i hear emacs+cider is great too

nikki04:10:44

ya i’m v comfortable with emacs atm and was using slime for lisp, so cider will be great!

nikki04:10:34

this sounds enlightenmenty

nikki04:10:37

i love aphoristic writing

nikki05:10:17

btw const createModule = function* () { const exports = {}; while (true) { eval(yield exports); } } is a livecodey JS repl 😉 need to stick to var for def tho

netchkin05:10:26

@shaun-mahood : I believe I have finally pinpointed the core of the issue. It should be the clojurescript compiler, I am positive I have even found the line of code that causes this, but while reading this: https://github.com/clojure/clojurescript/wiki/Reporting-Issues, I feel crushed by the sheer weight of what I must do to even report the bug, let alone see if I can fix it...

nikki07:10:05

anyone know of any cljs books that are like a literate programming book that you can eval regions from in emacs

roman01la12:10:09

What’s the idiomatic way to cache functions with local deps which are being passed from parent to child components so that shouldComponentUpdate check doesn’t fail on child components?

(rum/defc Head [prop]
  [:div
    (render-row #(Row prop %))])

roman01la12:10:32

I can think of storing a function within local state, but it doesn’t feel clean.

dnolen13:10:42

@netchkin for many cases - reporting an issue is typing a sentence and clicking a button. in your case it would be helpful to supply something minimal (reproducer). You can of course supply something non-minimal but who will spend time to look at your issue then?

dnolen13:10:44

@netchkin looking at the backlog it seems that it would be trivial for you to supply a failing case outside of your project - make an example where a :foreign-lib file starts with an r and test that on Windows.

dnolen13:10:07

@nfisher your expectation does not hold - we do not namespace random :foreign-libs - only in the case where they can be processed as some standard JS module type

nfisher14:10:23

@dnolen: understood, just didn't work as I expected.

netchkin14:10:30

@shaun-mahood: thanks, that had not occurred to me! As soon as I get home, I'll file the issue. Btw, I was thinking that I would download the source code and try to fix the bug myself, wouldn't you happen to know if there's a guide on how to do so? I mean the technical part, getting the cljs running

shaun-mahood14:10:40

@netchkin: I think that last reply was meant for @dnolen, right?

robert-stuttaford14:10:32

speaking as someone who’s just done this for the first time last week, it’s actually super easy. clone https://github.com/clojure/clojurescript, script/bootstrap, script/build, copy the version it outputs to your project, start your cljs build.

chris-andrews15:10:42

Has anyone kicked the tires on including commonjs modules in clojurescript? I’ve been trying to get it to work, but can’t access the modules from clojurescript

anmonteiro15:10:05

@chris-andrews it should be considered an Alpha feature, but here are some resources: A repository that you can have a look at where it’s working: https://github.com/mneise/circle-color newly added docs to the ClojureScript website referring to this feature: http://clojurescript.org/reference/javascript-module-support

anmonteiro15:10:56

if anything still doesn’t work for you after having gone through those, and you think you’ve found a bug, do report it in the ClojureScript’s JIRA!

chris-andrews15:10:38

@anmonteiro thanks a lot! I’ll try this out and see how it goes

gtrak15:10:53

is there a way to tell the closure compiler to not apply 'advanced mode' to a particular cljsjs dep, but use it everywhere else, in this case React? React->closure ends up clobbering window vars like Em, which unhappily belongs to Ember.

chris-andrews15:10:53

ok, for the commonjs support: so far, so good. appears to work fine as is in the example and still works for me when I bump to clojure 1.8.0 and cljs 1.9.229

arohner21:10:29

Can you ^:export another library’s function?

anmonteiro21:10:19

@arohner it might be possible with some analyzer sorcery

arohner21:10:25

I want to call om.dom/div dynamically, and not break advanced compilation

anmonteiro21:10:30

I don’t know exactly what it would entail, but probably hooking into the compiler analysis for the namespace that you want to mess with and add the :export metadata to the definition

arohner21:10:28

sounds messy

anmonteiro21:10:57

it definitely is

anmonteiro21:10:04

I can’t think of any other way right now

anmonteiro21:10:33

@arohner oh actually it might be simpler than that

anmonteiro21:10:59

give me 1 sec

anmonteiro21:10:04

@arohner try this: (js/goog.exportSymbol “om.dom.div”, om.dom/div)

arohner21:10:14

interesting

tanzoniteblack22:10:39

you could also probably get away with something like: (def ^:export div om.dom/div) ?

tanzoniteblack22:10:56

and then just call div instead?

kenny22:10:39

How do you handle providing utility functions for a library that may or may not be included in your final project. e.g. I want to provide some utility functions for Datascript in my library. The project that uses my library may or may not have Datascript as a dependency. I can't add Datascript to my ns :require in my library because then projects that use my library and don't have Datascript as a dependency will not compile due to the missing Datascript dependency. clojure.spec.gen get's around this by lazily loading test.check. Is there an equivalent in Clojurescript?

kenny22:10:05

Obviously I could move the Datascript utility functions into their own ns but I would prefer to keep all my functions together, avoiding the creation of a namespace for every library I want to create utility functions for.