cnuernber / dtype-next

A Clojure library designed to aid in the implementation of high performance algorithms and systems.
Other
328 stars 20 forks source link

Protocol method return type hints can't be primitive #101

Open puredanger opened 3 months ago

puredanger commented 3 months ago

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.

cnuernber commented 2 weeks ago

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.