This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-16
Channels
- # aleph (1)
- # aws (1)
- # beginners (23)
- # boot (33)
- # cider (15)
- # cljs-dev (4)
- # clojure (73)
- # clojure-dev (18)
- # clojure-italy (8)
- # clojure-russia (7)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (118)
- # clojure-ukraine (3)
- # clojurescript (34)
- # code-art (1)
- # community-development (24)
- # cursive (21)
- # data-science (3)
- # datomic (72)
- # defnpodcast (1)
- # fulcro (77)
- # graphql (4)
- # hoplon (8)
- # jobs (3)
- # luminus (3)
- # lumo (7)
- # off-topic (3)
- # onyx (17)
- # other-languages (7)
- # pedestal (1)
- # perun (1)
- # protorepl (21)
- # re-frame (91)
- # ring (4)
- # ring-swagger (18)
- # shadow-cljs (22)
- # spacemacs (37)
- # specter (1)
- # sql (23)
- # test-check (4)
- # unrepl (29)
- # utah-clojurians (3)
- # vim (36)
- # yada (10)
Does (cljs.reader/read-string ":/")
work on recent versions of cljs? Should it?
Okay. I have an older version where it doesn't, so I'll figure out how to upgrade; thanks
Clojurescript vs the Stacktraces: A Tragicomedy of Errors. (Or just a big misunderstanding?)
I've recently taken a deep dive into trying to parse/map/return humane stacktraces in Clojurescript and have hit my head on the bottom of the pool.
@mark-i alias
takes the both arguments as symbols: (alias 'extra 'hello-world.extra)
By humane, I mean parsed stacktraces that return function/file/line/column for the original source files at runtime. It looks like the machinery is all there (mostly in cljs.stacktrace and cljs.source-map), but I can't figure out how to assemble it.
How about this syntax for JS object destructuring? https://gist.github.com/pesterhazy/42c94768ed3dd991ea83ae96b4a6f57e Any other ideas?
The primary issue I see at this point is figuring out how to generate/get access to the sourcemaps, building up a structure that would be passed to cljs.stacktrace/mapped-line-column-col
(https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/stacktrace.cljc#L564-L568)
If anyone has a little experience with this, or is at least willing to talk some of it through with me, I'd appreciate it.
@juhoteperi thanks, I tried, but with same error. The alias call works in clj.
@pesterhazy Destructing already has :keys, :some-ns/keys, :strs, :syms
So if you want functionality for JS objects I'd add another keyword there instead of some other syntax
FWIF, you can:
(extend-type default
ILookup
(-lookup [o k] (aget o k)))
(let [{:strs [a]} #js{:a 2}]
a)
Not that I'd recommend doing that.yeah I'm looking at a way that you'd actually want to use in projects, so extending protocols seems dangerous
@rauh, adding a new keyword may be a good idea, but to my mind those are all shortcuts for the long form, {binding key}
where key
would be a key, string, sym etc
the other problem I see is that using a {}
form implies (to me) that the value is a persistent map, not a js object
i.e. :keys
, :strs
etc modify the type of key, not the type of object you're dealing with
What about just making it a js object? #js {background-color "backgroundColor", :keys [color]}
People usually use {:keys [...
though, and (let [{:js-keys [color]} ...
would be more aesthetically pleasing I think.
Anyone tried their luck with https://github.com/sivertsenstian/visualclojure?
Is there a way in cljs that returns âPersistentSomethingMapâ for (type m)
instead of some function? I find it easier to debug that way
@john92.walter, using #js
would be the logical thing, I agree - but not sure if a macro can deal with a reader macro like that