Fork me on GitHub
#clojurescript
<
2015-12-12
>
danielcompton01:12:51

@richiardiandrea: how did you do all of those things?

richiardiandrea01:12:06

they are all just compiler flags...except dump core that is described, we followed -> https://github.com/clojure/clojurescript/wiki/Optional-Self-hosting

richiardiandrea01:12:48

note that this is required just for bootstrapped cljs...as we cannot use :optimizations :advanced

mfikes03:12:54

David recently referred to an interesting feature https://clojurians.slack.com/archives/clojurescript/p1449702186005954 and here is a demo of what it looks like https://gist.github.com/mfikes/567c85c6473f2c4b511b partially working. It could be cool if it pans out. simple_smile

nooga12:12:00

I want to write an article with embedded cljs repl so that readers can run and modify code listings

nooga12:12:36

what should I use for that? is there some state of the art embeddable repl lib for cljs in cljs or do I have to roll my own?

rburns13:12:24

think this is aimed at that sort of use https://github.com/ScalaConsultants/replumb

malcolmsparks14:12:07

Is it possible for a clojurescript macro to call a function? I'm asking because I'm surprised but the error I'm getting with this simple code:

malcolmsparks14:12:31

(defn foo []
  (println "foo"))

(defmacro call-foo "call foo"
  []
  `(foo))

malcolmsparks14:12:57

When running my tests (phantomjs) I get the following:

malcolmsparks14:12:02

ERROR in (foo-test) (at cljs$lang$test (file:13:17)
Uncaught exception, not in assertion.
expected: nil
  actual: #object[TypeError TypeError: undefined is not an object (evaluating 'juxt.iota.foo')]

Ran 1 tests containing 1 assertions.
0 failures, 1 errors.

Subprocess failed

malcolmsparks14:12:23

The ns is juxt.iota

jaen14:12:24

But didn't you quote a Clojure function, since macros run in Clojure not Clojurescript?

malcolmsparks14:12:55

yes, that may be it - how do I quote the function?

malcolmsparks14:12:27

I don't usually write macros in clojurescript projects, but I'm trying to write tests for juxt.iota which is based on macros

jaen14:12:01

Well, you can call Clojure functions during macroexpansion, but you can't emit them in the quoted form - Clojurescript won't see Clojure code after all.

jaen14:12:20

You have to define the function you want used in the expanded form defined in a Clojurescript file.

jaen14:12:59

And then you need to use the fully qualified name for the symbol.

jaen14:12:29

At least, I think so.

jaen14:12:56

It might be confusing that Clojurescript macros run in Clojure and thus see different set of available symbols than the expanded code will.

malcolmsparks14:12:20

But even so, I still don't understand why this doesn't work :-

malcolmsparks14:12:25

(defn foo []
  (println "foo"))

(defmacro call-foo "call foo"
  []
  `(juxt.iota/foo))

jaen14:12:40

Are those in the same file?

malcolmsparks14:12:41

(ns juxt.iota)

(defn foo []
  (println "foo"))

(defmacro call-foo "call foo"
  []
  `(juxt.iota/foo))

malcolmsparks14:12:58

ah, yes, they're in the same file

jaen14:12:12

Yep, you have to move foo over to a Clojurescript file

malcolmsparks14:12:32

this is a .cljc file, so I need to move the macro to a .clj file

malcolmsparks14:12:40

ah, this is now making a little more sense

malcolmsparks14:12:47

.cljc has confused me

jaen14:12:43

Yeah, you can't have macros in Clojurescript source files. I suppose emitting the macro with reader conditional for :clj might work, but I didn't try it.

malcolmsparks14:12:05

right, that now makes sense, thanks guys

jaen14:12:49

No problemo, first time I encountered that phase difference I was confused as well. And by the fact that you can't use println during macroexpansion due to rebound *out*

malcolmsparks14:12:33

oh, I didn't know that - thanks for the warning!

malcolmsparks14:12:24

really appreciate your help on this, I was banging my head against a wall and my head was beginning to hurt simple_smile

jaen14:12:49

Otherwise you'll just clobber the compiler's output.

jaen14:12:23

Yeah, I can imagine. It's unfortunately a Clojurescript limitation that you have to be aware of.

malcolmsparks14:12:30

debug-prn - that's a good one to know

jaen14:12:51

Yup, when debugging Clojurescript macros - certainly.

malcolmsparks14:12:09

I just about grokked the clj for macros, cljs for clojurescript, but then .cljc came along and confused me!

malcolmsparks14:12:50

I guess macro writers need to be punished occasionally and today was my turn

jaen14:12:07

The first rule of macro club..., eh? ; d

malcolmsparks14:12:12

I have upset the macro gods, I'm going off to make a sacrificial offering...

malcolmsparks14:12:28

thanks again for your help @jaen

jaen14:12:33

Again - no problem.

mfikes15:12:14

I took a stab at “modernizing” the Differences fro Clojure wiki page to accurately accommodate some of the newer notions we now have with the existence of bootstrapped ClojureScript: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure/_compare/3dbb64badb7cd1313f6507505c26ef20e73e52c7...001b020761f33a75d5e6e82b13100c2c1d616306

triss18:12:02

Has anyone experienced an issue where by SyntheticMouseEvents have an unexpected source in Reagent?

triss18:12:10

I keep getting the following targets: target: svg, currentTarget: body,

triss18:12:36

when I'm not listening for them. just listening on a rect drawn on the SVG.