Fork me on GitHub
#clojurescript
<
2021-06-11
>
gdanov10:06:24

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?

🐛 3
borkdude10:06:20

@gdanov You can upvote the issue to signal more priority

borkdude10:06:43

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

gdanov10:06:21

thanks. my vote is #2 so I’ll take it to the chanel

Schpaa12:06:14

Oh no, I got swallowed by a “No reader function for tag object.”

Schpaa12:06:40

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

Schpaa12:06:20

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

quoll14:06:02

Sorry… I don’t see context for this. Do you know the tag that you’re failing on?

emccue15:06:37

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

emccue15:06:56

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

emccue15:06:47

at least thats my guess for what happened

👍 4
quoll15:06:11

Yes, that’s exactly how the reader sees it

quoll15:06:29

Is this imported data, or did you generate it?

quoll15:06:50

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

quoll15:06:26

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.

quoll15:06:33

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

quoll15:06:10

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.

emccue20:06:56

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

emccue20:06:09

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

emccue20:06:22

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

thheller20:06:56

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

emccue21:06:53

won't that get the ns of the macro

thheller21:06:33

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

thheller21:06:21

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