Fork me on GitHub
#clojurescript
<
2015-12-27
>
atroche02:12:31

@jbaiter: was the code undergoing advanced compilation? and did you try it at the REPL?

crocket04:12:56

Why is "doc" function lost after moving to another namespace after launching a CLJS REPL?

rm06:12:13

crocket: because it defined in cljs.user namespace

crocket06:12:37

After I move to another namespace, cljs.user loses doc function.

rm06:12:30

hmm... how did you test this?

crocket06:12:49

(ns something.core)
(doc anything)
(cljs.user/doc anything)
(ns cljs.user)
(doc anything)

rm07:12:21

you're right

rm07:12:29

same for clj

crocket07:12:56

How can I fix this bug?

johannjohann07:12:12

so when you are in another namespace

rm07:12:53

crocket: see docs in your editor. For example, in fireplace it's :Doc command

johannjohann07:12:04

you no longer have 'cljs.repl' required

crocket07:12:09

fireplace?

johannjohann07:12:13

which is the namespace the 'doc' function exists in

rm07:12:36

johannjohann [10:05] you no longer have 'cljs.repl' required and how is this possible?

crocket07:12:29

I don't use fireplace on VIM.

johannjohann07:12:41

how is what possible?

rm07:12:02

crocket: it's just example, use any editor/plugin you like. johannjohann: and in clj it's different:

dmca-ui.server=> (doc map)
-------------------------
clojure.core/map
([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
  Returns a lazy sequence consisting of the result of applying f to
  the set of first items of each coll, followed by applying f to the
  set of second items in each coll, until any one of the colls is
  exhausted.  Any remaining items in other colls are ignored. Function
  f should accept number-of-colls arguments. Returns a transducer when
  no collection is provided.
nil
dmca-ui.server=> (ns dmca-ui.ws-router)
nil
dmca-ui.ws-router=> (dmca-ui.server/doc map)

CompilerException java.lang.RuntimeException: No such var: dmca-ui.server/doc, compiling:(/tmp/form-init7902851373642829696.clj:1:1) 
dmca-ui.ws-router=> (require '[dmca-ui.server :as ss])
nil
dmca-ui.ws-router=> (ss/doc map)

CompilerException java.lang.RuntimeException: No such var: ss/doc, compiling:(/tmp/form-init7902851373642829696.clj:1:1) 

johannjohann07:12:51

'doc' doesnt exist in those namespaces

johannjohann07:12:57

it exists in clojure.repl in clj, cljs.repl in cljs

rm07:12:55

oh, good

rm07:12:07

thank you

johannjohann07:12:55

clojure.main/repl-requires

johannjohann07:12:07

and you'll see the stuff that gets automagically required when you start a repl

rm07:12:35

nice! where did you get all this? I'd like to read it too

johannjohann07:12:24

heres the injection point in fireplace

johannjohann07:12:33

i just grepped for it--knew the require stuff was getting injected just didnt know where simple_smile

johannjohann07:12:14

let me know if i can clarify anything crocket!

crocket07:12:58

I figured out that auto-completion is broken on cider after moving to another namespace if cider is connected to figwheel via nREPL.

crocket07:12:08

No, auto-completion breaks in cider after moving to a new namespace.

jimmy11:12:17

hi guys is there any good example of using react component in clojurescript ?

jimmy11:12:28

particularly in om. Thanks

jaen11:12:00

But it should map relatively easily to om's lifecycle events.

crocket12:12:43

Is there an equivalent to (use) in clojurescript?

crocket12:12:58

After invoking (ns), I have to refer to doc by cljs.repl/doc.

jaen12:12:23

But it seems you should be able to do (ns blah (:use [cljs.repl :only [doc]]))

crocket12:12:55

Is :use supported?

jaen12:12:56

Not in general

jaen12:12:05

But the wiki says you can use it with :only

jaen12:12:07

> You must use the :only form of :use

crocket12:12:15

Is it ok to use ns on repl?

jaen12:12:24

I don't remember using it with Clojurescript, but in Clojure it is not a problem

jaen12:12:01

It basically desugars to in-ns and appropriate uses, refers and such.

crocket12:12:07

ClojureScript's interop story is still painful.

jaen12:12:14

Somewhat, and probably won't get all that much better, but it's certainly came a long way since a year or two.

borkdude14:12:16

what's wrong with cljs interop story?

borkdude14:12:42

I don't see a big difference with clj and think it's pretty good

crocket14:12:41

The REPL auto-completion

crocket14:12:54

How does clojurescript handle code auto-completion?

borkdude14:12:31

I think it depends on your editor/IDE

crocket15:12:34

How do I add clojurescript API docset to Zeal?

mfikes15:12:39

@crocket: ClojureScript REPLs, by default, behave a lot like the Clojure REPL you get when running it from the JAR. Lein's Clojure REPL adds auto-complete, and Planck adds it as well, but it is not a base capability.

mfikes15:12:54

@crocket: You can use ns in a REPL. In ClojureScript, ns is a special form.

mfikes15:12:57

The require ClojureScript REPL special is implemented in terms of ns.

mfikes15:12:00

@crocket: after switching to a new namespace in the REPL, you should be able to (require-macros '[cljs.repl :refer [doc]])

not-much-io15:12:59

Is the package listing missing from http://cljsjs.github.io/ ? Or is it just me?

not-much-io15:12:55

Looking at the pages repo an automatic update was triggered an hour ago, probably that?

richiardiandrea17:12:00

@crocket: in my case I put the docset you can download in .local/share/Zeal/Zeal/docsets/ClojureScript.docset/

peterbak20:12:04

looking for a good async http lib. CLJS wiki lists cljs-http, cljs-ajax, jeluard/happy.. can anyone recommend any other good one that I might be missing? easy integration with core.async is a huge plus.

christopherbui20:12:11

@peterbak: You're looking for something to send messages to and from client/server?

johannjohann20:12:22

anyone have any experience requiring amd foreign-libs with clojurescript? little shaky on my first principles about what seems to be going amok 😞

christopherbui20:12:16

Aleph would require some minor work in order to get the stuff into core async

christopherbui20:12:00

@johannjohann: What are you trying to do

johannjohann20:12:58

poking around module-rewriting stuff in the cljs compiler

johannjohann20:12:38

i included an amd module to be included in a cljs build

johannjohann20:12:18

but when the browser tries to load the file im getting a 'require is not defined' error

johannjohann21:12:10

seems like theres a race condition with when i include my cljs code and when the require stuff is loaded

johannjohann21:12:16

will look more closely at examples

jaen21:12:18

@johannjohann: how are you doing this?

johannjohann21:12:27

hi @jaen lemme garner a gist rn simple_smile

jaen22:12:59

@johannjohann: oh, sorry, I've missed the gist. This seems to look sensibly. I'm not sure about a race condition though - the :module-type option means that the module will be translated to GClosure module, so it will be loaded exactly like the rest of your code, so this shouldn't exhibit any behaviours that wouldn't happen with the rest of your Clojurescript codebase, theoretically at least.

jaen22:12:30

I've had experience mostly with CJS modules, but this should work similarly with AMD - this is all translated by GClosure codebase into GClosure modules.

jaen22:12:52

Is the file you include as a foreign lib a single file, or does it require something else still?