per a discussion in https://clojure.atlassian.net/browse/CLJ-2953, i wonder if clj-kondo should warn on 0-arity uses of eduction:
$ echo "(eduction)" | clj-kondo --lint -
linting took 8ms, errors: 0, warnings: 0what bad things can happen? what does Alex say?
the arglist and docstring contract is 0+ xforms, 1 coll
the impl works if you provide no collection, but it's "undefined behavior"
in the future, the contract might be made explicit and throw if called without a collection
how common is this error now?
usage of (eduction) seems to be very limited (2-5 instance on github)
my proposal would be an entry in the args.clj file that has like eduction {:1 {:1 seq :ret any} {:varargs ...}}
(i don't remember the specific format, my apologies)
this still doesn't report anything I think, since clj-kondo will also see the varargs signature in the source code
ah, bummer
the thing you're mentioning is just for the type system
but if the source code changes, then clj-kondo will start reporting too
okay
Perhaps those weird (eduction) cases on github are because people just needed something of type Eduction
that's very possible
(cc @alexmiller we're discussing that eduction ticket)
so a backward compatible way of handling this would be (eduction '()) as the result of (eduction) perhaps
right, alex actually opened an issue about this in one of the cases: https://github.com/uncomplicate/fluokitten/issues/29
re the existing uses - yes, I think that's all it is
I opened ones for fluokitten and malli. the other ones from Ambrose all seem like tests
cool, then never mind. seems folks are using it correctly and we can probably ignore unintended zero-arg arity
fluokitten's issue already closed and fixed :)
i've updated the jira ticket with a patch removing the 0-arg arity, so this will be a non-issue when rich reviews and merges my code later this evening 😉
ha