ClojureScript
Javascript
A typical day with Javascript
A tense day with Javascript
A brutal day with Javascript
@lxsameer
- Senior Engineer with 12 years experience in the field
- A free software guy
- Contributed to projects like: Rails, Debian, Emacs, GNU, ReactNative, Clojure, ClojureScript, Pedestal, etc
I'm here to share an interesting experience I had
JS has a lot of Stupid in it.
- Brendan Eich (creator of Javascript)
Why Javascript
- About 20 years with Javascript
- It's everywhere
- It's going to be there for a long time
- Well engineered engines
Why not Javascript ?
- Poor design
- Constant changes
- Weird behaviors
Transpilers
- CoffeeScript
- TypeScript
- PureScript
- ...
Enter ClojureScript
Clojure is a dynamic, general-purpose programming language supporting interactive development; a functional programming language featuring a rich set of immutable, persistent data structures. As a dialect of Lisp, it has a code-as-data philosophy and a powerful macro system.
What's Clojure?
Clojure & ClojureScript
- Simple
- Dynamically Typed
- Data oriented
- Functional
Why Google Closure?
- Backed by Google
- Many years in production
- Robust libraries
- Best compiler in JS world
Syntax
Clojurescript syntax is stable. It doesn't change every year
List of Javascript operators
List of ClojureScript operators
(....)
It might looks scary, but it's really easy
Count the parenthesis in your code!
Size
CLJS
goog.dom: 23k
JS
JQuery: 29k
Advance Compilaiton
JS dependencies
Only required functions
Tooling
JS Tooling
Clojurescript Tooling
Leiningen
Workflow
- REPL
- Tools like Cider
- Figwheel
- Devcard
Demo
CallBack Hell
Core Async
Fragile foundations
- No stdlib for JS
- Constant changes
- Backward incompatible
- Google Closure is there
Debugging
Interop
Performance
No, it's not slow at all
Immutable data structures
Types & Spec
Put types where it makes sence
Clojure.spec
Demo
Editors
-
Emacs
-
Atom
-
Cursive
-
LightTable
-
NightLight
-
Vim
-
....
CLJS & Rails
1) Do it manually
2) Separate Client and Server
3) Gems
Community
It's not as big as JS, but...
re-frame stars: 2,709
CLJS stars: 7,280
References
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
- https://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs
- https://www.youtube.com/watch?v=gsffg5xxFQI
- https://www.youtube.com/watch?v=XfzXFWTT-z0
- https://www.youtube.com/watch?v=Rlu-X5AqWXw
- https://medium.com/@rajaraodv/using-preact-instead-of-react-70f40f53107c
- https://clojurescript.org/guides/faq-js
- http://practicaltypography.com/why-racket-why-lisp.html
- https://corbt.com/posts/2015/03/16/clojurescript-in-rails.html
- https://github.com/lxsameer/clojurescript-rubymeetup-demoapp
Stay in touch
- lxsameer@gnu.org
- @lxsameer everywhere
- #clojure-ireland
- #clojure
Q&A
Thanks
ClojureScript
By Sameer Rahmani
ClojureScript
- 1,423