dtype-next icon indicating copy to clipboard operation
dtype-next copied to clipboard

Protocol method return type hints can't be primitive

Open puredanger opened this issue 1 year ago • 1 comments

As we were working on this issue https://clojure.atlassian.net/browse/CLJ-2698, we were looking in the world for cases of defprotocol methods with ^double and ^long return type hints (which are not valid - protocol methods always return Object) and found PECount in tech.v3.datatype.protocols - I would recommend removing the type hints as it is not valid. I am not expecting any change in behavior in Clojure in 1.12.

puredanger avatar Jun 04 '24 15:06 puredanger

Thanks Alex for the notification - its odd that arguments to the protocol functions can be primitives but the return type cannot be.

I think there is a pretty good argument for removing the protocol callsite 'optimization' from the compiler entirely and then making this just work as expected.

cnuernber avatar Sep 11 '24 17:09 cnuernber