clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
gdanov 2021-06-11T10:22:24.179Z

just hit this bug reported sep 2019 https://ask.clojure.org/index.php/8497/protocol-implementations-metadata-clojurescript-differently?show=8497 any way to track it in public jira or request core team to review it?

šŸ› 1
borkdude 2021-06-11T10:26:20.179700Z

@gdanov You can upvote the issue to signal more priority

borkdude 2021-06-11T10:27:43.180900Z

Also you could ask in #cljs-dev if there is already a JIRA issue for this and if there is interest in addressing it

gdanov 2021-06-11T10:34:21.181Z

thanks. my vote is #2 so Iā€™ll take it to the chanel

Schpaa 2021-06-11T12:05:14.181500Z

Oh no, I got swallowed by a ā€œNo reader function for tag object.ā€

Schpaa 2021-06-11T12:48:40.182100Z

So, the local-storage cache had a corruption, removed it and everything is fine

Schpaa 2021-06-11T12:49:20.182500Z

But that error message really got me hanging not knowing what to do

quoll 2021-06-11T14:38:02.182700Z

Sorryā€¦ I donā€™t see context for this. Do you know the tag that youā€™re failing on?

emccue 2021-06-11T15:01:37.182900Z

A JS object's default string representation is #object[Object]

emccue 2021-06-11T15:01:56.183100Z

that would be interpreted by the reader as a tagged literal with tag #object

emccue 2021-06-11T15:03:47.183300Z

at least thats my guess for what happened

šŸ‘ 2
quoll 2021-06-11T15:16:11.183500Z

Yes, thatā€™s exactly how the reader sees it

quoll 2021-06-11T15:16:29.183700Z

Is this imported data, or did you generate it?

quoll 2021-06-11T15:35:50.183900Z

If you can regenerate the code, then thatā€™s what you want to do. If you canā€™t, then you can break bend the rules:

=> (def a (edn/read-string {:readers {'object identity}} "#object[Object]"))
=> (type a)
cljs.core/PersistentVector
=> (type (first a))
cljs.core/Symbol

quoll 2021-06-11T15:37:26.184100Z

You can have a non-namespaced reader tag (in this case 'object) and it will give you a 1 element vector with the symbol Object inside of it. You can choose to do what you want. Itā€™ll get you through the reading phase anyway.

quoll 2021-06-11T15:38:33.184300Z

To the best of my knowledge, this is not documented, and it could break in futureā€¦ but itā€™s a possibility if you have no other choices

quoll 2021-06-11T15:52:10.184500Z

The reason I think itā€™s against the rules is because the Clojure reader docs and the edn docs say that tags have to be namespaced. However, this is not enforced.

emccue 2021-06-11T20:49:56.185500Z

what is the best way to get the calling namespace in a macro

emccue 2021-06-11T20:50:09.185900Z

as a strawman, i'd like to write a macro that does

emccue 2021-06-11T20:50:22.186300Z

(my-macro abc) -> ::calling.ns/abc

thheller 2021-06-11T20:57:56.186700Z

(defmacro my-macro [x]
  (keyword (str *ns*) (name x)))

emccue 2021-06-11T21:08:53.187200Z

won't that get the ns of the macro

thheller 2021-06-11T21:09:33.187600Z

no, *ns* is bound to the "current/calling" ns when expanding macros.

thheller 2021-06-11T21:10:21.188200Z

there is also (-> &env :ns :name) but thats CLJS only, *ns* also works in CLJ