Live data from Hacker News

ClojureScript Is Not An Island: Integrating Node Modules

clojurescript.org

31–40 of 43 posts

Re: ClojureScript Is Not An Island: Integrating Node Modules

#32
post #24

Earlier quoted context omitted.

That's a surprisingly positive result. Usually I expect most JavaScript libraries to be destroyed by Closure's Advanced optimizations, unless they've been written specifically with Closure in mind (which they're not). Anyway, congrats on those features :-) Scala.js doesn't do the part where Closure is applied on JS dependencies; it's only applied to Scala.js code (though with the advantage that we never need any exte…

how does interop works in scalajs without externs?

The Scala.js compiler, thanks to its static types, precisely knows which property accesses refer to "internal" properties (defined in Scala code, which can be renamed) and which ones refer to external JavaScript code (which cannot). It then simply always emit the former using dot notation (foo.bar) and the latter with bracket notation (foo["bar"]). This allows Closure to rename all internal property accesses but not external property accesses.

It's even slightly more powerful than using externs: if you use the same property name both in internal accesses and external ones, Scala.js can rename the former without touching the latter. An externs-based solution won't be allowed to rename the internal accesses.

Re: ClojureScript Is Not An Island: Integrating Node Modules

#34
post #3

Earlier quoted context omitted.

It sounds like this handles extern inference if possible. Is that the case? I have wanted to play around with Webrtc for a while now but it basically requires adapter.js ( https://github.com/webrtc/adapter ) and as a result a ton of externs. It would be cool if I could just plug and play!

There's no extern inference required here as all the original sources are passed directly through Google Closure Compiler. As a benchmark for feasibility when we started we chose React.js as it's non-trivial and heavily depended upon in the ClojureScript ecosystem. We discovered that over all of React's sources we only need 4 extern definitions for 4 generated names in EventsPlugin. So as long as the JS library in qu…

What were those four names?

Re: ClojureScript Is Not An Island: Integrating Node Modules

#35
post #33

What's the best resource for learning CLJS as of mid 2017?

Depends whether you learn best by reading [1], answering some interactive questions/koans [2], or downloading and playing around with a ToDoMVC app example [3][4][5] or a mixture of the above. Feel free to join the #clojurian Slack channel [6] if you need help.

As a beginner, I recommend you looking at the Reagent [7] or Rum [8] React library first, than you can look at something more complex and full-featured like Om [9] later (whose author is also a ClojureScript core contributor @swannodette).

PS: You can also learn by implementing a Dashboard like this [10]. Disclaimer: I am the author of this library.

[1] http://funcool.github.io/clojurescript-unraveled/

[2] http://clojurescriptkoans.com/

[3] http://todomvc.com/examples/reagent/

[4] https://github.com/reagent-project/reagent/tree/master/examp...

[5] https://github.com/gadfly361/cljs-todomvc

[6] http://clojurians.net/

[7] https://reagent-project.github.io/

[8] https://github.com/tonsky/rum

[9] https://github.com/omcljs/om

[10] https://github.com/priornix/antizer

Re: ClojureScript Is Not An Island: Integrating Node Modules

#36
post #34

Earlier quoted context omitted.

There's no extern inference required here as all the original sources are passed directly through Google Closure Compiler. As a benchmark for feasibility when we started we chose React.js as it's non-trivial and heavily depended upon in the ClojureScript ecosystem. We discovered that over all of React's sources we only need 4 extern definitions for 4 generated names in EventsPlugin. So as long as the JS library in qu…

What were those four names?

He was referring to these https://github.com/cljsjs/packages/blob/950064853c8391ac7a88...

Re: ClojureScript Is Not An Island: Integrating Node Modules

#37
post #33

What's the best resource for learning CLJS as of mid 2017?

Depends whether you learn best by reading [1], answering some interactive questions/koans [2], or downloading and playing around with a ToDoMVC app example [3][4][5] or a mixture of the above. Feel free to join the #clojurian Slack channel [6] if you need help. As a beginner, I recommend you looking at the Reagent [7] or Rum [8] React library first, than you can look at something more complex and full-featured like O…

I like small books that build progressively more complex projects (Dave Thomas's Elixir book was good that way, Realm of Racket was my favorite). Short video tutorials are nice as a supplement are nice, too. Daily Drip's elm videos were fantastic.

The #1 thing I'm usually looking for is something that eliminates any time-wasting hassles related to getting set up, and all the major language features in some set of working examples.

After that, I usually write little command line apps, play with graphics a bit and convert some simple games into the language.

Re: ClojureScript Is Not An Island: Integrating Node Modules

#38
post #37

Earlier quoted context omitted.

Depends whether you learn best by reading [1], answering some interactive questions/koans [2], or downloading and playing around with a ToDoMVC app example [3][4][5] or a mixture of the above. Feel free to join the #clojurian Slack channel [6] if you need help. As a beginner, I recommend you looking at the Reagent [7] or Rum [8] React library first, than you can look at something more complex and full-featured like O…

I like small books that build progressively more complex projects (Dave Thomas's Elixir book was good that way, Realm of Racket was my favorite). Short video tutorials are nice as a supplement are nice, too. Daily Drip's elm videos were fantastic. The #1 thing I'm usually looking for is something that eliminates any time-wasting hassles related to getting set up, and all the major language features in some set of wor…

Not ClojureScript but Clojure: I really liked www.braveclojure.com. Maybe not technical enough for the most folks in here, but it was a great starter since you jump right into and solve some problems. Still it was not too newbie focused (Write a program which prints Hello World and calculates the sum out of two numbers). Sadly i wasn't able to stick with clojure since i cant wrap my head around jvm and clojure always felt like something which is fun but will not help me in the future job market.

Re: ClojureScript Is Not An Island: Integrating Node Modules

#39

How did clojurescript use node modules / APIs before?

Using NPM for client libraries required using Webpack to bundle those things. If you were targeting Node.js then we just didn't support idiomatic usage of those libraries (users could just call require themselves directly).
Post reply on HN