Fork me on GitHub
#clojurescript
<
2015-12-19
>
mike13:12:35

I find [fractalify.components.dialog :as dialog] verbose.

mike13:12:20

the function we want to use here is fractalify.components.dialog/dialog the naming is too long.

mike13:12:54

is there a way to reduce it to fractalify.components/dialog but keep the dialog function in its own file?

jindrichm13:12:40

I cannot reproduce https://github.com/clojure/clojurescript/wiki/Dependencies#bundling-foreign-javascript-code with Clojurescript version 1.7.170. Is it still valid?

jindrichm13:12:58

@mike: You can use :refer to require specific vars: [fractalify.components.dialog :refer [dialog]]

jaen13:12:46

@mike: well, I'm not sure how idiomatic it is, but I do name things like that - I want to have things in separate namespaces, but don't want to refer to long names, so I use :as to alias the namespace.

jaen13:12:26

It might be slightly verbose, but it's just an import you do once (and your editor/IDE might also be able to do them for you)

mike13:12:18

so, it's not the same as goog closure namespacing.

dnolen14:12:29

this is how CLJSJS works which many people depend on

jindrichm14:12:41

@dnolen: I followed the Quick start and the mentioned documentation of 'Bundling "Foreign" JavaScript Code', but when I launch browser REPL and run (require '[yq]), then it cannot be found: clojure.lang.ExceptionInfo: No such namespace: yq, could not locate yq.cljs, yq.cljc, or Closure namespace "yq" {:tag :cljs/analysis-error}

dnolen14:12:00

@jindrichm: I cannot help you with your specific problem

dnolen14:12:16

but the wiki is up-to-date and correct on dependencies

dnolen14:12:22

nothing has changed in almost a year

jindrichm14:12:44

@dnolen: Is it correct to provide :foreign-libs to cljs.build.api/build?

dnolen14:12:12

@jindrichm: compiler options are always provided in the same way

dnolen14:12:21

draw your conclusion from this more general statement

dnolen14:12:59

@jindrichm: the exception is trying to give you more information

dnolen14:12:13

which is that the dependency could not be found

dnolen14:12:34

so my guess is that you do not have the file on the JVM classpath

dnolen14:12:45

@jindrichm: also you said “browser REPL"

dnolen14:12:56

which doesn’t know anything about cljs.build.api/build

dnolen14:12:18

so you will need to duplicate whatever compiler options you are using when constructing the REPL

jindrichm14:12:26

@dnolen: Do I need to provide the :foreign-libs option to cljs.repl/repl too? (Ah, you just answered that...)

jindrichm14:12:38

@dnolen: How do I pass compiler options to cljs.repl/repl? (doc cljs.repl/repl) is empty.

dnolen14:12:35

@jindrichm: this is implied in the Quick Start

dnolen14:12:07

you just pass compiler options as keyword arguments

dnolen14:12:22

or use cljs.repl/repl* which takes a compiler options map

jindrichm14:12:34

Finally, I made it work. Thanks, @dnolen for the help!

jindrichm16:12:34

Do you have to place externs file on the class path (or :source-paths if using cljsbuild)?

pat21:12:05

If I want to throw a js Error from a macro that needs to be in a .cljc file correct?

frank21:12:24

I can't seem to evaluate let bindings inside of a #js {} expression... is this expected behaviour?

frank21:12:28

I get a compiler warning

WARNING: Use of undeclared Var sme.handlers/message at line 16 src/sme/handlers.cljs
This is the code:
(go
  (let [status (<! ch)
        message (case status
                  :up-to-date "Up to date."
                  :updated "Updated.")
        response #js {"message" message}] ;; line 16
    (js/console.log message) ;; line 17
    (.json res response)))

frank21:12:46

note that I don't get a warning for line 17

frank21:12:51

and the console.log works just fine there

pat21:12:30

it would be simpler to alts! on status

frank21:12:11

@pat: how would you use it here? I'm not quite sure what it does, after reading the docs

pat21:12:32

My brain is mushy so may be wrong, but i think core async has idioma for doing case like stuff

jaen22:12:57

un-mangled variable names? Neat ❤️

darwin22:12:18

right now, it is just extracting a nice prefix and adding an index number, but for eval’ing cljs in the context of debugger I want to have some nice solution, so that you can mention variable names you see in the scope panel and they would reference real generated names

darwin22:12:38

I think there will be clash with active repl namespace anyways, while in debugger, local names have to be referenced as js/name from cljs

martinklepsch23:12:25

@darwin: dirac looks great 👍