rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.66k stars 193 forks source link

Kotlin.js complains that ArrayBuffer is not defined. #439

Closed sleekweasel closed 10 months ago

sleekweasel commented 7 years ago

I've compiled a trivial hello world in kotlin to js, and unzipped the kotlin js runtime version 1.1.3-2 (the default under macos brew) from /usr/opt/kotlin/libexec/lib/kotlin-jslib.jar into a directory cleverly called kotlib.

Running V8::Context.new.load('kotlib/kotlin.js') causes

V8::Error: ArrayBuffer is not defined From kotlib/kotlin.js:790:12 from 10:9 from 12:2 from irb:3 from .../irb:11 in main.

V8 reports 3.16.14.11-x86_64-darwin-14

sleekweasel commented 7 years ago

So I tried the latest v8, and the result is much the same:

Updating files in vendor/cache

ignisf commented 7 years ago

Hi,

trr is not compatible with libv8 > 3.16 :(

I suspect that v8 3.16 does not have the ArrayBuffer feature. You could maybe try mini_racer?

sleekweasel commented 7 years ago

Thanks, that's helpful - mini_racer gets as far as complaining about 'console' not being defined, which I can work around with some variant of:

 c.eval('console={log: function () { console.out += JSON.stringify(arguments); }}')
 c.eval('console.out')
 => "undefined{\"0\":\"Hello, world!\"}" 

Still, I'd prefer to use RubyRacer in the longer term, although this is no longer a blocker as such.

ignisf commented 7 years ago

I'd consider this a duplicate of #438