Fork me on GitHub
#clojurescript
<
2016-11-19
>
br11k00:11:38

Ok here is the another issue, I'm trying to use [quiescent "0.3.1"] and it needs sablono.core? Here is the output: "No such namespace: sablono.core, could not locate sablono/core.cljs, sablono/core.cljc, or Closure namespace "sablono.core""

noisesmith00:11:00

@br11k: interesting - this makes it look like they don't use sablono https://crossclj.info/ns/quiescent/0.3.2/project.clj.html - but maybe they misspecified their deps?

noisesmith00:11:57

@br11k this also indicates that quiescent doesn't use sablono

[email protected]: ~/quiescent$ lein deps :tree
Possibly confusing dependencies found:
[jonase/eastwood "0.2.1"] -> [org.clojure/clojure "1.6.0"]
 overrides
[lein-cljfmt "0.5.3"] -> [cljfmt "0.5.3"] -> [rewrite-cljs "0.4.1"] -> [org.clojure/clojurescript "1.7.228" :exclusions [org.apache.ant/ant]] -> [org.clojure/clojure "1.7.0"]
 and
[lein-cljfmt "0.5.3"] -> [cljfmt "0.5.3"] -> [rewrite-cljs "0.4.1"] -> [org.clojure/clojure "1.7.0"]
 and
[lein-cljfmt "0.5.3"] -> [cljfmt "0.5.3"] -> [org.clojure/clojure "1.7.0"]

Consider using these exclusions:
[lein-cljfmt "0.5.3" :exclusions [org.clojure/clojure]]
[lein-cljfmt "0.5.3" :exclusions [org.clojure/clojure]]
[lein-cljfmt "0.5.3" :exclusions [org.clojure/clojure]]

Retrieving cljsjs/react-with-addons/15.1.0-0/react-with-addons-15.1.0-0.pom from clojars
Retrieving cljsjs/react-dom/15.1.0-0/react-dom-15.1.0-0.pom from clojars
Retrieving org/clojure/tools.reader/1.0.0-alpha1/tools.reader-1.0.0-alpha1.jar from central
Retrieving cljsjs/react-dom/15.1.0-0/react-dom-15.1.0-0.jar from clojars
Retrieving cljsjs/react-with-addons/15.1.0-0/react-with-addons-15.1.0-0.jar from clojars
 [alembic "0.2.0"]
   [lein-as-resource "2.1.3"]
   [org.flatland/classlojure "0.7.0"]
   [org.tcrawley/dynapath "0.2.3"]
 [cljsjs/react-dom "15.1.0-0" :exclusions [[cljsjs/react]]]
 [cljsjs/react-with-addons "15.1.0-0"]
 [clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
 [criterium "0.4.2"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/clojurescript "1.7.228"]
   [com.google.javascript/closure-compiler "v20151216"]
   [org.clojure/data.json "0.2.6"]
   [org.clojure/google-closure-library "0.0-20151016-61277aea"]
     [org.clojure/google-closure-library-third-party "0.0-20151016-61277aea"]
   [org.clojure/tools.reader "1.0.0-alpha1"]
   [org.mozilla/rhino "1.7R5"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]
 [org.clojure/tools.trace "0.7.6"]
[email protected]: ~/quiescent$ grep -r sablono .

noisesmith00:11:11

err - hard to see from that, but grep for sablono returned no results

br11k00:11:57

@noisesmith Oh, I see, actually sablono.core used in the core.cljs.

noisesmith00:11:39

ahh, so you need to manually add sablano to your project deps I guess?

br11k00:11:48

Yep that's what I've discovered

br11k00:11:08

Trying to use outdated guides is so painful haha 😄

br11k00:11:11

Probably there is something like that but I never found it

noisesmith00:11:11

doesn't the official clojurescript quickstart or figwheel quickstart have this stuff?

br11k00:11:16

I don't know. I've just googled this stuff. Saw "reload-less workflow" mentioned and assumed this article is the only way to get things right.

noisesmith00:11:32

google is bad at keeping up with clojure

noisesmith00:11:00

the official docs are usually better than what google hands you in my experience

br11k00:11:42

@noisesmith Is there a way I could see packages available for :dependencies?

noisesmith00:11:02

as in, browse the packages you could try?

noisesmith00:11:15

http://crossclj.info shows packages and who uses them

noisesmith00:11:20

though its UI is weird

noisesmith00:11:01

there is also lein search

noisesmith00:11:39

[email protected]: ~$ lein help search
Search remote maven repositories for matching jars.

The first run will download a set of indices, which will take a very long time.

The query is evaluated as a lucene search. You can search for simple string
matches or do more advanced queries such as this:

  $ lein search clojure
  $ lein search description:crawl
  $ lein search group:clojurewerkz
  $ lein search "id:clojure version:1.6"
  $ lein search "Riak client"

Also accepts a second parameter for fetching successive pages.

Arguments: ([query] [query page])

br11k00:11:49

Keeps telling me "No such namespace: quiescent, could not locate quiescent.cljs, quiescent.cljc, or Closure namespace "quiescent"". Tried: 1. [quiescent "0.3.2"] 2. [quiescent/quiescent "0.3.2"] 3. [levand/quiescent "0.3.2"] How namespaces work?

noisesmith00:11:12

those are not namespace names, those are dependencies

noisesmith00:11:25

a dependency can provide namespaces and packages

noisesmith00:11:37

require is used to get namespaces provided by a dependency

noisesmith00:11:50

import is used to get classes from packages in a dependency

noisesmith00:11:24

the docs for a project should describe the namespaces available, failing that, you can browse the code in the jar (a good editor can open a jar, it's a special zip file)

br11k00:11:57

But it still cannot find "quiescent" namespace

noisesmith00:11:03

there's no such thing

noisesmith00:11:16

look at the quiescent docs or source to find the namespaces it offers

noisesmith00:11:41

a dependency is a package that can provide whatever namespaces or classes it likes

br11k02:11:58

Woohoo finally works

br11k02:11:33

@noisesmith Thank you very much for help!

anthonylebrun03:11:44

I just started learning ClojureScript because I was looking for a functional front-end and after trying Elm for a bit it didn’t quite sit right with me (coming from a dynamic programming language background in ruby/js/elixir). After getting over the initial parentheses shock, I love what I’m seeing so far and in particular #re-frame 🙂

shaun-mahood03:11:02

@anthonylebrun: Wecome! I hope you enjoy ClojureScript.

br11k05:11:09

@shaun-mahood That looks depressingly large 😰

shaun-mahood05:11:59

@br11k: Come on over to #re-frame or message me directly if you want to chat about it - I think it’s pretty straightforward to get started with and would be happy to help you unpack things with you.

hwk05:11:15

@br11k: you may find https://dl.dropboxusercontent.com/u/561580/conferences/2015.07%20polyconf.pdf interesting , it's on datascript, but has similar idea of "1 global source of truth"

shaun-mahood05:11:10

@hwk @br11k: Most of the modern ClojureScript libraries and frameworks have a lot of similarity and they are all pretty awesome, there’s a ton of ideas passing back and forth between them all. For DataScript and Rum, https://www.youtube.com/watch?v=2fLx4fu9VV8&amp;index=1&amp;list=PLKWlLYzr2TiwOFrH7Qe9imye2pJWKE8fo is a recent video about the same idea by the same author and there’s definitely some awesome stuff in there, he’s also got a longer workshop at https://www.youtube.com/watch?v=RqHnxkU9TZE if you want more info

hwk05:11:54

@shaun-mahood : on your recommendation; watching this now; also, yeah, let's move to #re-frame

br11k08:11:27

@shaun-mahood @hwk Thank you, I'll sure read/watch these when I get more free time. Still need to make money using PHP 😉

munen13:11:19

Is there a way to read the project.clj version from CLJS? From CLJ it would be pretty straight forward, slurp the file and read-string it. After about 30min of thinking and googling I thought it might be prudent to ask here.

darwin13:11:41

@munen why don’t you read it in a macro and emit required parts in cljs?

darwin13:11:11

I’m assuming you want to use something from project.clj in cljs code at runtime

munen14:11:27

@darwin That totally works. I’m still kinda new to this, so I didn’t know that this is a thing. I will have to read up a bit to actually understand what I did. Create a Macro in CLJ that I call in CLJS at runtime which then runs code it otherwise couldn’t. Pretty crazy stuff. Big thanks for the hint!

andrewboltachev15:11:08

Hi. Sorry for asking about basic things, but are CLJS Atoms just pure JS variables like var x = 1; (of course they that have multiple properties such as state etc), while Clojure ones use AtomicReference etc for thread-safety?

mfikes16:11:02

@andrewboltachev In ClojureScript, defs are close to pure JavaScript variables, while atoms are more complicated structures that provide the needed semantics. If you are curious, here is the heart of it: https://github.com/clojure/clojurescript/blob/c0c8ce446e9b5bf425d46d136e17b3a208ed32e0/src/main/cljs/cljs/core.cljs#L4228-L4255

andrewboltachev16:11:57

thanks, in fact, I'm programming web for quite a while, but I figured out only today (while being confused about CLJS) what does it really mean that "JS is single-threaded". TIL 😄

mfikes16:11:20

@andrewboltachev Right, the single-threaded aspect of JavaScript informs the way atoms are implemented in ClojureScript as compared to Clojure. For example, if you do (source swap!) at a REPL, you will see that in ClojureScript it can rely on the single-threaded nature and it is built on top of reset!.

andrewboltachev16:11:38

aha, got it, thanks! In the meantime, I'm also reading famous "Java Concurrency in Practice" by Brian Goetz. In fact, I enjoy the book a lot

shdzzl18:11:17

Does anyone know of a good library that wraps three.js or provides similar functionality? Quil does not seem as full-featured for 3D.

mikebelanger19:11:14

@shdzzl there's a THREE.js wrapper you can find here : http://cljsjs.github.io/ , the project symbol is [cljsjs/three "0.0.76-0"]

mikebelanger19:11:44

@shdzzl by the way, I'm currently working on a wrapper (very WIP) for blend4web, if you're using Blender for assets https://github.com/mikebelanger/cljs-blend4web

shdzzl20:11:08

@mikebelanger Thanks, I'll take a look at your repo when I start looking at assets. I'm using cljsjs at the moment actually. I was after something that might provide abstractions more idiomatic to clojure, the way om and reagent do with react. If not, I might see what I can come up with when I get the time.

gfredericks20:11:20

What's the correct way to call (.exit js/process 42)? ⇐ that fails under advanced compilation

anmonteiro20:11:43

@gfredericks hrm I don't think ClojureScript can be compiled for Node.js with advanced optimizations

gfredericks20:11:07

well everything works except that call

anmonteiro20:11:30

but there are 2 solutions for that: 1. create externs for process 2. use goog.object/get: (.call (goog.object/get js/process "exit") nil 42)

anmonteiro20:11:53

@gfredericks btw 1. isn't hard at all:

var process = {
  exit: function(code){}
};

darwin20:11:54

with cljs-oops, it should be as easy as (gcall “process.exit” 42) (a shameless plug) 🙂

mfikes20:11:41

Also, perhaps with the latest stuff in the compiler (last day or so), maybe it will “just work” in the future. 🙂

mikebelanger20:11:43

@shdzzl agreed, the interface to THREE is pretty minimal, and therefore not that idiomatic to clojure. I'm struggling to make the same kind of idiomatic interface to blend4web right now, and I'm open to ideas

gfredericks21:11:53

externs seems to be a noop :/

cigitia22:11:46

Web APIs that require ES6 classes are starting to appear. For instance, the finalized Custom Elements v1 specification requires ES6 classes (https://github.com/w3c/webcomponents/issues/587). It appears to be possible, but very impractical, to use these APIs using polyfilled or transpiled non-ES6 code (e.g., https://github.com/babel/babel/issues/4480). This seems to be due to the special ability of extends and super() to subclass native-code constructors, which cannot be replicated in ES3/ES5 code. There is the Polymer shim by Justin Fagnani, but its implementation is pretty complicated (https://github.com/w3c/webcomponents/issues/587#issuecomment-259775926), and it must be loaded even for browsers that actually have implemented Custom Elements, such as Google Chrome and Safari Technology Preview. Does anyone around know whether there any known plans for ClojureScript someday to be able to output ES6-`class`-using code, for the sake of cleaner interoperability with these new APIs? Thanks!