Fork me on GitHub
#clojurescript
<
2017-08-11
>
atroche00:08:57

has anyone else had problems with namespaced maps in clojurescript? when I do #:: {:a 1} in clojurescript 1.9.854 I get: clojure.lang.ExceptionInfo: Invalid token: :: {:type :reader-exception, :line 1, :column 4, :file "NO_SOURCE_FILE"}

atroche00:08:28

same thing when I do (clojure.reader/read-string "#:: {:a 1}") in cljs

mfikes01:08:38

@atroche Can't repro that:

$ java -jar cljs.jar -m cljs.repl.node
ClojureScript Node.js REPL server listening on 53986
To quit, type: :cljs/quit
cljs.user=> *clojurescript-version*
"1.9.854"
cljs.user=> #:: {:a 1}
#:cljs.user{:a 1}

amitayh09:08:49

hi, i was wondering if there鈥檚 a cljs library that works similarly to cyclejs, but with core.async instead of rxjs?

atroche16:08:18

@mfikes thanks, that's interesting! I'm trying it in figwheel:

app:cljs.user=> *clojurescript-version*                                                                               
"1.9.854"                                                  
app:cljs.user=> #:: {:a 1}                                                                                            
clojure.lang.ExceptionInfo: Invalid token: :: {:type :reader-exception, :line 1, :column 4, :file "NO_SOURCE_FILE"} 
and it's not just at the repl, it also just fails to compile. worth filing an issue on figwheel's github, or might I be doing something obviously wrong?

atroche16:08:04

also, when trying to reproduce your node example:

java -jar clojurescript-1.9.854.jar -m cljs.repl.node
no main manifest attribute, in clojurescript-1.9.854.jar
where can I get a jar which lets me run cljs.repl.node like you do?

atroche16:08:14

cheers 馃檪

mfikes17:08:27

@atroche I can鈥檛 repro with Figwheel.

Prompt will show when Figwheel connects to your application
To quit, type: :cljs/quit
ios:cljs.user=> *clojurescript-version*
"1.9.854"
ios:cljs.user=> #:: {:a 1}
#:cljs.user{:a 1}
It is probably worth checking to make sure you don鈥檛 have an old version of org.clojure/tools.reader on your classpath.

atroche17:08:03

aha, will do

dominicm17:08:53

What's the idiomatic way to require/import goog.string.format? Seems to just be a function

anmonteiro17:08:54

@dominicm

(require '[goog.string :as gstr]
         'goog.string.format)

dominicm17:08:06

Hmm, I have a suspicion, but what's the rationale?

mfikes17:08:54

See Sometimes symbols are *not auto-included* when requiring their parent namespace. This happens when those symbols are in their own file and require specific inclusion on the page

anmonteiro17:08:06

and then use it with gstr/format

dominicm17:08:51

I think I looked at something out of date: http://clojurescriptmadeeasy.com/blog/when-do-i-use-require-vs-import.html Probably from the github wiki. Thanks, I should familiarise myself with that site more

atroche17:08:59

@mfikes thanks, that was it 馃檪

newres17:08:59

i got a question about using specs in clojurescript. When i try to generate a value for a spec that i defined with s/def in another namespace i get Error: Unable to construct gen at: [] for: . It works fine when I generate for a spec in the current namespace. What am I missing?

anmonteiro17:08:32

^ this one is more recent

mfikes17:08:20

@newres Do you have a minimal repro of the exact forms you are evaluating?

newres17:08:54

@mfikes I can put together something for this.

captainlexington18:08:49

Does anybody have any experience with chromex and writing Chrome Extensions? Is the ClojureScript runtime overhead worth it? What are some architecture best practices (a la re-frame)?

captainlexington18:08:09

And what about compatibility with Firefox, and the WebExtensions API in general?

souenzzo19:08:42

+1 to firefox support

spinningtopsofdoom18:08:00

@darwin has created a custom chrome extension for a better ClojureScript REPL debugger Dirac https://github.com/binaryage/dirac

spinningtopsofdoom18:08:31

IIRC he's also documented how to build a chrome extension from ClojureScript

newres19:08:30

@mfikes I think i figured out a minimal repro: (ns specbasics.repro (:require [cljs.spec.alpha :as s])) (s/def ::spec1 string?) (ns specbasics.repro-test (:require [cljs.test :refer-macros [deftest testing is]] [specbasics.repro :as repro] [cljs.spec.alpha :as s] [cljs.spec.gen.alpha :as gen] [clojure.test.check.generators] )) (deftest valid-repro-test (let [example1 (gen/generate (s/gen string?))] (is (string? example1 )) (is (string? (gen/generate (s/gen repro/spec1))) )))

newres19:08:29

it basically breaks on the second is: I get a Error: Unable to construct gen at: []

newres19:08:46

i feel like I am missing something pretty basic with importing but could not figure out what

mfikes19:08:01

@newres Near the end, you have repro/spec1. Should that perhaps be ::repro/spec1?

newres19:08:12

I knew it was something silly

mfikes19:08:28

@newres I immediately get a much better error message than the one you seem to be encountering:

cljs.user=> (require 'specbasics.repro-test)
WARNING: Use of undeclared Var specbasics.repro/spec1 at line 14 /Users/mfikes/Desktop/src/specbasics/repro_test.cljs

newres20:08:44

ah I looked over the warnings in the test runner it seems

tiagoantao20:08:43

Hi, I am trying to use :npm-deps with 1.9.854 and I am getting a Error: Cannot find module 'module-deps', does anyone hit this problem?

tiagoantao20:08:40

OK, the real problem is Uncaught Error: Undefined nameToPath for module$home$tiago_antao$stats$node_modules$vega_lite$build$package_json (vega-lite is a charting library that I am trying to use on clojurescript

anmonteiro20:08:25

@tiagoantao can you try master?

anmonteiro20:08:41

before I look into your problem I鈥檇 like to know if it鈥檚 not fixed in master already

tiagoantao20:08:15

@anmonteiro Sure, but it will take me a bit as I am using leiningen

anmonteiro20:08:31

doesn鈥檛 have to take a bit

anmonteiro20:08:39

clone ClojureScript and ./script/build

anmonteiro20:08:47

note down the version number

anmonteiro20:08:48

and use it in Lein

tiagoantao20:08:24

@anmonteiro I've got Error: Cannot find module '@cljs-oss/module-deps' (but figwheel starts OK) but then I get a less ugly variation of the error above: Uncaught Error: Undefined nameToPath for vega_lite on the browser

anmonteiro21:08:21

do you have a package.json file in your project鈥檚 directory?

tiagoantao21:08:35

@anmonteiro yep, I just updated figwheel to 0.5.12 and still no joy

anmonteiro21:08:57

k I鈥檒l take a look

anmonteiro21:08:21

can you paste the modules you鈥檙e trying to consume and how you鈥檙e requiring them?

tiagoantao21:08:04

thanks, here it is:

tiagoantao21:08:24

from project.clj:

tiagoantao21:08:29

:compiler {:main stats.core
                        :asset-path "js/compiled/out"
                        :output-to "resources/public/js/compiled/stats.js"
                        :output-dir "resources/public/js/compiled/out"
                        :source-map-timestamp true
                        :preloads [devtools.preload]
                        :language-in :es5
                        :npm-deps {:vega-lite "2.0.0-beta.10"}
                        :pretty-print false
                        :optimizations :none

                        :static-fns true}}

tiagoantao21:08:06

The code:

(ns stats.core
  "Stats playground"
  {:author "Tiago Antao"}
  (:require vega-lite))

tiagoantao21:08:28

@anmonteiro : but a bare bones project that just requires vega-lite should expose this

anmonteiro21:08:57

@tiagoantao I think you just need to add :install-deps true to your compiler options

anmonteiro21:08:47

Closure Compiler does seem to have a little bit of trouble converting everything in vega-lite

anmonteiro21:08:52

but I can load it in the browser

anmonteiro21:08:59

you鈥檙e probably just not installing deps

tiagoantao21:08:32

@anmonteiro Thanks! Indeed I get a lot of errors on the console (`require is not defined` for example). I do have at least one that seems serious: goog.require could not find: vega_lite