Fork me on GitHub
#cljs-dev
<
2021-06-11
>
gdanov10:06:18

Hi, just hit compatibility issue re protocols & metadata

Alex Miller (Clojure team)12:06:47

I would consider this a bug. The ordering of choices was carefully chosen here in Clojure.

gdanov13:06:24

great, I could not find jira ticket for this so I guess there isn’t.

gdanov14:06:39

btw satisfies? returns false when protocol is implemented via meta. the behavior in this case is not documented in the function doc.

Alex Miller (Clojure team)14:06:57

that is a separate issue and does have a CLJ jira

gdanov14:06:51

thanks. should’ve searched it

thheller14:06:07

my bad on that one. currently pretty busy but I can try to squeeze in a patch if you want, maybe next week.

dnolen15:06:00

@thheller no worries, I'm looking at it

Brice Ruth15:06:07

Posted this in #clojurescript, not realizing this channel existed, but thinking it's maybe more appropriate here?

borkdude15:06:04

@bdruth This channel is for CLJS compiler and std lib dev

Brice Ruth15:06:38

ohhh, gotcha - my bad, I misinterpreted. apologies! /me slinks back to #clojurescript 😉

thheller20:06:42

@dnolen I think that still fails with :static-fns true. the direct property check/invoke still happens before hitting the dispatch function. somewhere in emit* :invoke IIRC

dnolen20:06:05

@thheller the tests are advanced compiled and tested locally first

dnolen20:06:03

but I agree about that case being a possibility

dnolen20:06:28

ah there is an edge case

thheller20:06:30

hmm odd. thought static-fns was the only thing affecting that but maybe not

dnolen20:06:36

but only in the predicate fn path

dnolen20:06:52

i.e. implements?

dnolen20:06:10

but that cannot happen in this case anyway I don't think

dnolen20:06:51

but I think pretty edge-casey and this will solve most expectations for now

thheller20:06:20

hmm I thought the protocol property check was the default (with static-fns) rather than an edge case

thheller20:06:50

(let [x (with-meta (SomeMetaImpl. 2) {`ext-meta-protocol (fn [_] 1)})]
  (is (= 1 (ext-meta-protocol x))))

thheller20:06:03

this should fail then I think

dnolen20:06:37

Will test that later but the fjnal branch is not protocol stuff it’s just arity invoke

dnolen20:06:05

Protocol inlining is proto? Branch

thheller20:06:01

ah yeah right thats just IFn. sorry too tired for this 😛