Fork me on GitHub
#cljs-dev
<
2019-09-16
>
borkdude16:09:57

made some enhancements to clj-kondo which utilizes type hints. it found this: > cljs/util.cljc:361:19: error: Expected: integer, received: nil. https://github.com/clojure/clojurescript/blob/a760439b5084937a556712d6ee056e95f4f075c7/src/main/clojure/cljs/util.cljc#L359 that begs the question if the type hint is correct when the value can also be nil.

andy.fingerhut17:09:25

That is a boxed Long. References can be nil, primitives cannot?

andy.fingerhut17:09:58

If you are referring to the ^Long type hint on the parameter n, that is.

andy.fingerhut17:09:21

If the type hint on n were ^long, I would wonder about the type hint, too, but I can't see a reason for ^Long being incorrect.

mfikes17:09:50

Yeah, and there is that whole notion of ^long and ^double being type declarations (they are evidently special).

favila17:09:30

I think they cause the compiler to emit an impl of one of these interfaces: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java#L97-L454

mfikes17:09:35

Ahh cool. This is consistent with where I got this from: Clojure Programming p. 439

andy.fingerhut17:09:26

I was planning to make some fixes to the core.rrb-vector library, which has both Clojure/Java and ClojureScript implementations in the same repository. I wanted to set up automated running of ClojureScript tests for core.rrb-vector, which I think it does not right now. Alex Miller mentioned data.xml as an example of an existing library that does. I am starting to look into how that is set up, and noticed from the build logs that it is running the nashorn JavaScript runtime, and at least with JDK 11 it is starting to give deprecation warnings about nashorn maybe being removed in a future release.

andy.fingerhut17:09:30

If I was setting up running ClojureScript tests for core.rrb-vector, would you recommend I do it using nashorn so that it matches what data.xml is doing, and they can both be fixed if/when it is removed in the future? Or would you recommend I figure out how to set up a different runtime to run on the Hudson build box?

andy.fingerhut17:09:53

(or look at a different example than data.xml, that already uses a different JS runtime, if you know of such an example)

borkdude17:09:52

ah, so ^Long is nilable, gotcha

mfikes17:09:48

@andy.fingerhut May be of interest: https://clojure.atlassian.net/browse/CLJS-3088 (removed Nashorn from ClojureScript's CI) https://clojure.atlassian.net/browse/CLJS-2927 (a patch to suppress that deprecation warning) IIRC, core.rrb-vector supports self-hosted, so if feasible, I'd incorporate self-hosted into its test suite.

mfikes17:09:00

(As an additional thing, beyond regular JVM ClojureScript.)

andy.fingerhut17:09:27

Thanks for the links. I don't yet have a good working knowledge of what it means to run self-hosted tests vs. nashorn vs. some other option. My belief is that the http://build.clojure.org automated test results are all run on a machine running Hudson software, not using Travis, true?

andy.fingerhut17:09:06

Erm, or perhaps Jenkins, not Hudson, there.

mfikes17:09:35

Oh, yeah, that's a world that I'm not familiar with.

andy.fingerhut17:09:25

Sure, and please don't dive into it unless it sounds like your world of fun, which seems unlikely 🙂

andy.fingerhut17:09:15

Is your guess that this nashorn warning thing might be "they will actually leave the deprecation warning around until JDK 15, when they actually get around to removing it?"

mfikes17:09:51

That's a good question. I'm wondering / speculating if Graal.js is supposed to replace it. Dunno.

rarous05:09:19

Yes, it is.

andy.fingerhut17:09:53

If it might be a ways off, I may be a bit lazy and just make core.rrb-vector as much like data.xml as I can, so easier to update them in a common way later.

andy.fingerhut17:09:47

I was mainly looking for a reaction like "nashorn? Never, ever test with that any more -- it's too ancient to be of any use" vs. not that reaction 🙂

zane17:09:29

> I'm wondering / speculating if Graal.js is supposed to replace it. That's my understanding.