Fork me on GitHub
#clojurescript
<
2017-06-20
>
mfikes01:06:44

@dm3 Thanks again for the report that led to https://dev.clojure.org/jira/browse/CLJS-2101 . It was pretty cut-n-dry (laziness in the analyzer). Looks like you were 24 forms away from seeing it occur in regular JVM ClojureScript as well (it just happens sooner in self-host owing to lack of chunked sequences).

bolivier02:06:27

Is there a way to pass props to reagent components in devcards?

bolivier02:06:55

I have something like

(defn scaled-img [props]
  (let [url  (:src props)]
   [:img {:src url
          :style {:width "400px"
                  :height "300px"}}]))

(defcard simple-image
  "### a simple scaled image with a source"
  (let [url ""]
    (dc/reagent scaled-img))
  {:inspect-data true})

bolivier02:06:43

but I’m not sure how to pass something like {:src url} to scaled-img

bolivier02:06:50

(defcard simple-image
  (dc/reagent [scaled-image {:src ""}]))

bolivier02:06:57

That does the trick.

acuervo09:06:00

Anyone know of a CLJS framework that allows for custom tags? Hiccup/Sablono CLJS implementations in Re-frame and Om(.next) don’t handle non-standard HTML the last time I checked (which was last December, admittedly) — I’m trying to get A-Frame working in CLJS, which would require something like [:a-scene {custom-properties-too ""} // etc. ]

pesterhazy09:06:59

@acuervo you should be able to use non-standard html tags with React (reagent, om, etc.). One approach would be to use https://facebook.github.io/react/docs/dom-elements.html#dangerouslysetinnerhtml

moxaj11:06:52

`'clojure.core 
evals to (quote clojure.core) in clojure, (quote clojure/core) in clojurescript. Why the difference?

moxaj11:06:36

`'~'clojure.core 
however yields the same as in clojure

zilti11:06:23

Is there something special I have to configure in order to use json-response-fomat in cljs-ajax? Right now I get Error: No *print-fn* fn set for evaluation environment.

pesterhazy12:06:30

@zilti are you printing the result somewhere?

pesterhazy12:06:46

that's probably the issue - try js/console.log instead

zilti12:06:53

@pesterhazy: no, no println or something anywhere.

zilti12:06:26

I only use timbre logging, and that works flawlessly.

pesterhazy12:06:25

timbre may be printing using println

pesterhazy12:06:38

you have to call (enable-console-print!) somwhere

pesterhazy12:06:49

and it needs to be before the call to print

zilti12:06:41

No, Timbre prints into the console the way it is supposed to. That doesn't cause any errors.

zilti12:06:19

But I'll try (enable-console-print!) anyway, maybe it fixes cljs-ajax

zilti12:06:50

Hmm, apparently cljs-ajax always prints to console what it receives

deadghost12:06:09

I'm trying the new :npm-deps in cljsbuild

deadghost12:06:32

Should I be concerned about this? "WARNING: JSC_INVALID_ES3_PROP_NAME. Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option."

pesterhazy12:06:04

@zilti you're welcome!

metametadata13:06:48

Hm, it looks like there's a difference between uncaught instances of ex-info and js/Error. An uncaught js/Error produces much better stacktrace in Chrome, at least when thrown from core.async context. And Firefox shows no stacktrace at all on uncaught ex-info 🙂

dnolen14:06:39

@metametadata ex-info isn’t about browser support

moxaj14:06:45

adding to my previous question (shameless bump), the inner quote isn't necessary to demonstrate the difference:

`clojure.core   -> clojure/core

`~'clojure.core -> clojure.core

dnolen14:06:23

@metametadata that said if there’s a way to get ex-info to provide better traces, submit a patch! Seems like an easy one to do if it’s possible.

metametadata14:06:06

@dnolen got it! I'll need to look into it when I have some free time. I suspect there could be some browser-specific properties in js/Error objects which are not added into ex-info instances or smt. like that. So maybe it would be possible to create js/Error and then augment it with ExceptionInfo protocol instead of creating an instance of ExceptionInfo and copying data from js/Error into it. I dunno.

dnolen14:06:55

right somebody needs to play around with it

dnolen14:06:06

though I was pretty convinced we already did a bunch of work here

dnolen14:06:14

ExceptionInfo subclasses Error etc.

metametadata14:06:31

alright, thank you for the reply

mfikes14:06:16

@moxaj Can’t see your previous question.

dnolen14:06:58

@mfikes @moxaj I thought somebody filed a ticket for this recently? My question was whether this problem was at the reader?

dnolen14:06:36

@bronsa ? or maybe we’re doing something wrong?

bronsa14:06:28

i'll take a look

bronsa14:06:10

I think this might be caused by cljs's provided impl for tools.reader/resolve-symbol

bronsa14:06:19

cljs.analyzer> (env/ensure (resolve-symbol 'clojure.core))
clojure/core

Garrett Hopper15:06:54

How would I go about serving purecss from a webjar through an aleph server? My understanding is yada can support webjars? The only yada example I see is for serving swagger, not a resource.

bronsa15:06:29

ah yes, that seems to be the same issue

dnolen15:06:58

@richiardiandrea closed as dupe, thanks for finding it

richiardiandrea15:06:23

Awesome no problem!

anmonteiro16:06:11

@deadghost use :language-in :es5 in the compiler options

mikerod20:06:37

Does anyone know of any supporting specification that shows that

(identical? (goog.json.parse "\"a\"") (goog.json.parse "\"a\""))
(identical? (JSON.parse "\"a\"") (JSON.parse "\"a\""))
(identical? (js/eval "\"a\"") (js/eval "\"a\""))
These are going to always be true (in different js environments)

mikerod20:06:05

I think it mostly comes down to the behavior of JavaScript eval specification, but I haven’t found any good references stating what “same object instance” guarantees there are around strings in javascript.

mikerod20:06:51

Basically, I worry about the possibility of a parser etc to have this behavior instead (identical? "a" (js/String. "a")) ;= false

mikerod20:06:18

This relates back to cljs keywords, since they seem to be reliant on the identity semantics of their underlying string

mikerod20:06:32

ie

(let [a1 :a
      a2 (keyword "a")
      a3 (keyword (js/String. "a"))]
  [(= a1 a2)
   (= a2 a3)
   (= a1 a3)])

;;= [true false false]

mikerod20:06:11

In clj on jvm, keywords are assured to be unique and interned as a runtime Keyword constructor time cost, so the same concern didn’t apply

mikerod20:06:56

I've read both. I don't think they answer the question

mikerod20:06:32

keyword-identical? relies on the identical behavior of the underlying string.

mikerod20:06:24

As does Keyword Deftype's -equiv used by =

mikerod20:06:45

So my question is targeted at what we can rely on from JS when it comes to string identity.

dnolen21:06:59

@mikerod == always works on equal strings

dnolen21:06:16

your concerns about new String(...) applies to any of the native type constructors

dnolen21:06:28

don’t use them if you want to avoid such semantic pitfalls

dnolen21:06:20

Good chance this behavior is covered in the ECMA-262 spec? it’s a pretty small document

mikerod21:06:50

Yeah. I guess my concern was relying on thing like JSON parsers. If they have me new String() behavior unexpectedly then calling keyword on them would produce non = keywords.

mikerod21:06:17

I tried finding In spec. I'll have to look closer I guess. Seems to be a hard search topic to. I appreciate your inputs though.

dnolen21:06:30

unless your targeting strange runtimes I don’t see a cause for concern

dnolen21:06:59

if you’re targeting browser post IE >= 8 (2008), likely a non-issue

dnolen21:06:10

point being I don’t think any of the browser native JSON parsers exhibit this behavior

dnolen21:06:20

and not sure why you would be using anything else

dnolen21:06:51

(in browser I mean)

mikerod21:06:52

yeah, that’s what I was thinking

mikerod21:06:10

I was just trying to find any sort of “guarantee” of that because I started to question it in my head.

mikerod21:06:20

obviously testing it out is one way to know 😛

m21:06:27

hi! is there something similar to redux-dev-tools for figwheel? I'm looking for a way to track/debug/timetravel the state of a webapp...

m21:06:27

well, just realizing, that this is rather about re-agent than figwheel...

dnolen21:06:53

@mikerod (new Number(1) === 1); // false in JS

dnolen21:06:03

if JSON parsers worked like this no one would use them

mikerod21:06:34

@dnolen that is a good point

mikerod21:06:18

On the JVM side, I actually have been burned by JVM deserialization bringing in boolean values with new Boolean(), which CLJ doesn’t interact well with (relies on singleton Boolean/TRUE | FALSE). So I guess I am just paranoid of those types of things happening in deserialization layers. JS is a different world though of course.

dnolen21:06:18

yeah I think this madness in JS was copied over from Java

mikerod21:06:38

yeah, it’s not a “feature” I like about either one