Fork me on GitHub
#cljs-dev
<
2016-01-18
>
mfikes15:01:34

If I do this

(extend-type number
IFn
(-invoke [n m]
  (+ n m)))
I can then (-invoke 2 3) => 5. Should this also allow (2 3) => 5?

mfikes15:01:55

I suppose there's not a way to emit static JavaScript that would efficiently support this, considering cases like (n 3), where (number? n) is known to be satisfied only at runtime.

mfikes15:01:38

(Practical concerns aside, this is making me think that it is not strictly valid to emit a diagnostic at analysis time that (2 3) involves something that cannot be invoked.)

dnolen16:01:54

@mfikes it could be interesting - but you’re often not going to have enough type information to make a static optimization like that work

mfikes16:01:46

@dnolen: Yeah. I’m also thinking that the analysis diagnostic I mentioned above, (warning on simple cases like (2 3)), while perhaps useful, is not theoretically correct to do.

dnolen16:01:30

yeah I don’t think so

mfikes17:01:06

The ClojureScript compiler tests pass for me on Nashorn 8u66! (Previous versions of Nashorn would derail in some way.)

dnolen17:01:49

@mfikes: ah yeah worked for me too - just slow simple_smile

mfikes17:01:13

No *hit. I didn’t time it. Almost an order of magnitude. But, it works!

dnolen17:01:54

thanks for the confirm

dnolen21:01:57

@mfikes: glad to hear it!

dnolen21:01:11

looking forward to OS X builds of ChakraCore

dnolen21:01:48

@mfikes are you running this on a real Windows machine? if so I wonder how the basic benchmarks look

mfikes21:01:08

@dnolen: Parallels desktop on Mac. Maybe 5 seconds to run it. Slower than JavaScriptCore on my Mac but faster than Nashorn.

mfikes21:01:18

@dnolen when I get a bit of time, I'll install Node on that Windows 10 instance so we can at least see what the perf ratio is between Node and Chakra

dnolen21:01:39

cool, that would be useful

mfikes22:01:55

@dnolen: Actually, I downloaded Spidermonkey’s 64-bit windows js-shell, and used it. It takes approximately the same amount of time as ChakraCore (about 5 to 6 seconds).

dnolen22:01:14

ah ak interesting