Fork me on GitHub
#clojure-dev
<
2018-10-04
>
andy.fingerhut00:10:53

@ghadi Sorry for the directed ping, but also asking others, but I have a half-remembering of some code you wrote that demonstrates that at least some JVMs return methods matching by some partial signature in a non-deterministic order. Do you have that or a pointer to it handy?

ghadi00:10:49

No worries @andy.fingerhut I'll try to dig it up when I get home but essentially I called Class::getMethods on a clj function class, filtered only arity-0 things, and printed. You have to do it in fresh JVMs though

ghadi00:10:26

I think chouse_r had the original repro (would be nice to file an issue for it)

alexmiller15:10:52

@bronsa I was just working on https://dev.clojure.org/jira/browse/CLJ-2358 and saw your note there. On https://github.com/clojure/tools.reader/blob/master/src/main/clojure/clojure/tools/reader.clj#L1013-L1015 this works except you’ve violated the doc string which claims same args in same order as read. You’ve made (read+string reader opts) call (read opts reader). This is sane, no doubt, but does not agree with the docstring or where I’m heading with CLJ-2358.

bronsa15:10:39

@alexmiller subtle, let me know which direction you're going for CLJ-2358 and I'll follow

alexmiller15:10:51

will drop a patch shortly

alexmiller15:10:28

but it’s basically doing what the docstring says

alexmiller15:10:38

which is super irritating

bronsa15:10:50

breaking change on read+string then?

bronsa15:10:34

the docstring says "like read, taking the same args", but the impl doesn't, I don't see any way to make the impl match the docstring without changing the impl?

bronsa15:10:48

I'll wait for your patch for the answers :)

alexmiller15:10:04

yes, changing the impl

alexmiller15:10:41

I’m saying the docstring is the intent and the impl was broken (in Clojure itself as well)

bronsa15:10:52

:thumbsup:

ghadi15:10:56

i=0; while clojure -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-alpha8"}}}' -e '(require (quote clojure.pprint))' -e "(let [lass fc (class #())] (clojure.pprint/pprint (vec (filter #(zero? (.getParameterCount %)) (.getMethods fc)))))"; do echo '---';  i=$(( i + 1 )); done
@andy.fingerhut something like that could serve as a basis

andy.fingerhut20:10:00

If my "Rich/Stu/Alex sense" is anywhere near accurate (probably not), the fact that the JVM gives back a non-deterministic order here, leading to some people maybe wishing that Clojure sorted the return value in some deterministic way, is a highly suspect, risky, and needs-more-thinking-time enhancement, not a bug fix, yes?

ghadi22:10:22

In my book non-determinism is usually a bug