Fork me on GitHub
#clojurescript
<
2017-03-28
>
macrobartfast02:03:33

can anyone tell me how to add live reloading of the server code in the project one generates in https://github.com/omcljs/om/wiki/Intermediate-Tutorial ? I've been playing with the server side and have been running 'lein figwheel' again and again to see changes in core.clj. The cljs changes have been reloading beautifully, of course.

qqq03:03:43

https://github.com/raph-amiard/clojurescript-lua <-- is this the best for cljs on lua? (last commit looks like 5 years ago)

qqq03:03:53

I'm primarily interested in this for being able to use Torch from cljs

borkdude10:03:19

I want to add GraphiQL to my project. I’m currently trying via webjars: https://github.com/webjars/graphiql But I’m not sure what and how to add this using foreign libs

borkdude10:03:54

Does foreign libs expect a path on the filesystem or relative to the served output file via a webserver?

borkdude10:03:39

This answer says: > The path is classpath-relative and the contents of the resources/ directory are added to the classpath, meaning if you want to point to resources/jsonld.js in a classpath-relative way it's just jsonld.js. http://stackoverflow.com/a/34353911/6264

borkdude10:03:49

However, when I try:

:foreign-libs
                                [{:file "webjars/graphiql/0.3.1-1/graphiql.js",
                                  :provides ["graphiql"],
                                  }]
I get the error message: adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: /…/myproject/app/webjars/graphiql/0.3.1-1/graphiql.js (No such file or directory) from: :boot-cljs

borkdude10:03:09

Answered in #boot

Roman Liutikov13:03:01

Does anyone know if Closure modules namespace name should match directory structure? e.g. my.lib -> src/my/lib.js

thheller15:03:57

"should" yes ... but not a hard requirement. the name of the file is not important to Closure.

ghaskins13:03:36

hello all: fyi, i scratched an itch I had when dealing with cljs on the node platform: https://github.com/ghaskins/lein-nodecljs

ghaskins13:03:39

comments welcome

jrychter13:03:18

TIL ClojureScript has a function arity limit (22 it seems)

bronsa13:03:33

so does clojure

bronsa13:03:39

it doesn't apply for varargs, just fixed arities

jrychter13:03:07

In my ClojureScript code, it seems I'm blowing it up with varargs destructured as maps.

bronsa13:03:14

cljs.user=> (defn a [& b])
#'cljs.user/a
cljs.user=> (apply a (range 100))
nil

dnolen13:03:35

@bronsa it’s actually possible I think

bronsa13:03:35

unless you mean something else

jrychter13:03:47

Perhaps so, but "`Uncaught Error: Invalid arity: 23`" is hard to dispute with 🙂

dnolen13:03:09

if your generating signatures and you hit the limit for fixed arities I don’t think we do the right thing yet - mostly because no one has complained or worked on it 🙂

jrychter13:03:16

I wouldn't consider it a problem — in my case, it's the keyword options, and I should have grouped them into (several) maps anyway.

bronsa13:03:26

what's the fn signature, roughly?

jrychter13:03:55

[a b c & {:keys [lots of options]}]

bronsa13:03:05

@dnolen possible how? unless destructure expands differently in cljs than it does in clj i don't see how destructuring a vararg could cause that

bronsa13:03:25

cljs.user=> (defn a [x y & {:keys [a b c d e f g h i j k l m n o p q r s t u v w x y z ab bc cd ef fg hi jk lm no pq rs tu vw zy zz]}] )
#'cljs.user/a
cljs.user=> (a 1 2 :y 23, :q 23, :r 23, :v 23, :o 23, :bc 23, :fg 23, :cd 23, :n 23, :w 23, :m 23, :lm 23, :zy 23, :e 23, :s 23, :l 23, :k 23, :vw 23, :z 23, :g 23, :c 23, :rs 23, :j 23, :tu 23, :h 23, :b 23, :zz 23, :pq 23, :d 23, :f 23, :t 23, :x 23, :ab 23, :jk 23, :ef 23, :p 23, :i 23, :hi 23, :no 23, :a 23, :u 23)
nil

jrychter13:03:26

I just switched to [a b c & [{:keys [lots of options}] and I'm fine, but tracing it down took a while because of the strange (for me) error message.

bronsa13:03:35

¯\(ツ)

dnolen13:03:52

I think we’d need to see the stacktrace and the simple reproducer

bronsa13:03:52

maybe it's something to do with static fns

jrychter13:03:16

@bronsa Or the fact that it isn't really a defn, but a rum/defcs, so I'd have to see what really happens in the defcs macro.

bronsa13:03:35

that's more likely then

john14:03:22

So I'd like to put together a github project so others can test or improve on this webagents idea. Is there a canonical example of a third party library providing an iRef implementation?

jrychter14:03:23

Well, I do have a minimal example:

(ns arity.test
  (:require [rum.core :as rum]))

(rum/defc example-component [a & args]
  true)

(defn example-fn [a & args]
  true)

;; This works fine:
(apply example-fn (mapcat (fn [n]
                            [(keyword (str "arg" n)) (str "s" n)])
                          (range 11)))

;; This, however, breaks:
(apply example-component (mapcat (fn [n]
                                   [(keyword (str "arg" n)) (str "s" n)])
                                 ;; Works up to (range 10), (range 11) causes an exception.
                                 (range 11)))

jrychter14:03:16

I don't think I'm able to understand this further — should this be reported as a rum problem?

dnolen14:03:17

@jrychter stacktrace makes it clear, MetaFn issue

dnolen14:03:04

and perhaps missing compiler support

gklijs14:03:01

@jrychter don’t know this for sure, but it might break because you are passing more than 20 arguments to a functions, which is a hard limit set in clojure.

isaac16:03:39

what’s exactly way use proxy like Clojure in ClojureScript?

jr16:03:08

there is no proxy in clojurescript IIRC

jr16:03:10

what's your use case?

isaac16:03:31

extend a protocol dynamically

anmonteiro16:03:36

@isaac you may wanna consider looking at specify!

isaac16:03:42

@anmonteiro thanks, it’s look like an alternatives.

richiardiandrea17:03:22

Hey folks, question: is there the ClojureScript node repl supported in Cursive at the moment?

thheller17:03:01

@richiardiandrea start a cursive clojure.main repl, then (require '[cljs.repl.node :as cljs-node]) and (cljs-node/-main)

thheller17:03:49

nREPL is the part that doesn't work, clojure.main works just fine

dnolen17:03:34

@richiardiandrea pretty sure there isn’t any special ClojureScript REPL support in Cursive at all

dnolen17:03:59

but it isn’t hard to make it work - it’s just like the Quick Start - make a script

dnolen17:03:10

and make plain Cursive Clojure REPL that invokes it

isaac17:03:54

(identical? :keyword :keyword) ;=> false in ClojureScript?

isaac17:03:15

the result difference with clojure(clojure is true)

thheller17:03:16

@isaac keyword-identical? for that case

isaac17:03:30

oh! thanks, 🙂

isaac17:03:31

but clojure has no keyword-identical?, it seems i need replace it with = or use conditional reader

thheller17:03:26

with :emit-constants it will be true but yes avoid identical? on keywords or symbols

thheller17:03:41

everything else is safe

richiardiandrea17:03:31

@dnolen I am using mies and scripts should be already there, and it looks like it is even connecting to the repl...but the window is read-only and the bottom (modifiable) part does not show up...I'd better write to @cfleming 😄

dnolen17:03:43

@richiardiandrea there’s a #cursive channel I’m sure someone can help out

dnolen17:03:02

@richiardiandrea but this is what I do and it definitely works 🙂

dnolen17:03:28

@richiardiandrea make sure in your REPL setup that you are using the clojure.main option not the nREPL thing - common mistake

richiardiandrea17:03:08

ok, I will check, i have blindly executed script/repl in a colleague's terminal tnx

dnolen17:03:37

that won’t work

dnolen17:03:59

under the IntelliJ Run menu there’s Edit Configurations

dnolen17:03:10

you need to add a REPL configuration

dnolen17:03:23

and you don’t launch Bash scripts, you just launch the REPL script directly

macrobartfast17:03:25

can anyone point me to how to get the server side of the project in https://github.com/omcljs/om/wiki/Intermediate-Tutorial to reload on code changes (like adding routes)? I've tried wrap-reload and a number of other things without success. the client is reloading via figwheel awesomely. I'm an emacs/cider user if that's relevant.

macrobartfast17:03:59

I've been quitting the repl and restarting every time 😐

anmonteiro17:03:01

@macrobartfast if you’re using CIDER you should be able to use refresh from clojure.tools.namespace

anmonteiro17:03:19

just hit , in your CIDER REPL and start typing “refresh"

macrobartfast17:03:05

@anmonteiro ah ok... I'll have to figure out how to connect to a figwheel situation from cider, and then I'll try that

anmonteiro17:03:33

M-x cider-connect should work, no?

macrobartfast17:03:07

it doesn't, actually... the intermediate tutorial doesn't expose a port for that AFAIK... but let me double check.

macrobartfast17:03:01

I mean, whatever happens when you run 'lein figwheel' against the outcome of 'lein new om-intermediate-template om-async'.

anmonteiro17:03:46

I haven’t used Figwheel in a while, but I thought it started an nREPL server

macrobartfast17:03:01

I'll check now...

rgdelato17:03:38

Figwheel has an option to set an nREPL server port, but it doesn't do it by default, I don't think?

macrobartfast17:03:01

I actually had that working on a stock figwheel project (very cool) but for some as-yet-undetermined reason is not working on the intermediate project.

cfleming20:03:27

@richiardiandrea Dedicated CLJS REPLs and other improvements (socket REPLs etc) are the next major feature coming to Cursive.

cfleming20:03:40

Hopefully in the couple-of-weeks sort of timeframe.

johanatan22:03:50

hi, does anyone know how to expect an exception/assertion failure/failure/etc in a cljs.test.async test?

johanatan22:03:22

it seems that there's a "promise rejection" that I need to handle but I'm not quite sure which promise library is in play and the docs don't mention it.