In the repl example, you’re actually passing in 0, which is initialized as a long automatically by the reader. So the compiler can infer the type of the first arg. The second arg is reifying an interface, and I’m guessing the compiler is smart enough to determine that type as well.
In the second example, you never type what p-win is, or key-cb. I’d be willing to bet of those were hinted you would be okay.
I tried hinting types the way you suggested, but it still did not work.
I guess to invoke Java methods Clojure uses runtime reflection in repl and compile-time reflection when running code from command line, and in repl it can find method successfully, but somehow it can not do so when compiling.
Is it possible to not compile at all when running it like clj -m foo.core?