Fork me on GitHub
#cljs-dev
<
2018-07-09
>
mfikes02:07:32

@dnolen Thanks! Much simpler. I documented it on the README and pushed tubular 1.3.0 to Clojars.

mfikes15:07:07

When implements? was added, a consequence was that cljs.core/pr-writer would no longer honor arbitrary extend-type to, say object. (The last change in https://github.com/clojure/clojurescript/commit/7d3ce70a1c2f4d54b9044d2e44b62c8252e5dea6) Is this intentional, or was it just an oversight that a fallback that checks satisfies? wasn’t added (perhaps at the end of the cond)?

dnolen16:07:25

there’s still a satisfies? check

mfikes16:07:04

Ahh, it was in the older implementation at the time…

dnolen16:07:50

@mfikes yes so I think we need to look at why it was removed

mfikes16:07:10

Yeah, I’ll see if I can find a relevant commit

dnolen17:07:04

oh yeah I remember

dnolen17:07:12

because we have default printing for Objects

dnolen17:07:43

in general I would consider this a minor thing - we should check to see if this overrideable in Clojure itself

dnolen17:07:14

I’m talking about #object[...]

mfikes17:07:08

I guess in Clojure you can do

(defmethod print-method Object [o w] (.write w "hi"))
(or try to be more specific, as that is a bit coarse-grained)

dnolen17:07:55

so that works, that replaces the existing printing for Object?

mfikes17:07:34

Yeah

user=> (import '( URI))
java.net.URI
user=> (def uri (URI. "x"))
#'user/uri
user=> uri
#object[java.net.URI 0x48d5f34e "x"]
user=> (defmethod print-method Object [o w] (.write w "hi"))
hi
user=> uri
hi

dnolen17:07:10

ok then that was probably my fault

dnolen17:07:46

yeah we need to check to see if some has implemented the override before the final case

dnolen17:07:43

Testing it is annoying - since it affects how objects print - I might skip that?

mfikes17:07:44

OK, I’ll at least write a low-priority JIRA for now with some notes

mfikes17:07:33

We have the cljs.extend-to-object-test namespace that is specifically tested last, so we might even be able to have tests

mfikes17:07:05

I’ll put together a small patch for this for people to try.

dnolen17:07:16

cool, thanks