Kotlin.js complains that ArrayBuffer is not defined.
Closed this issue · 4 comments
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
So I tried the latest v8, and the result is much the same:
Updating files in vendor/cache
- libv8-5.9.211.38.0beta0-x86_64-darwin-14.gem
Removing outdated .gem files from vendor/cache - libv8-5.7.492.65.1-x86_64-darwin-14.gem
Bundle complete! 32 Gemfile dependencies, 132 gems now installed.
Usebundle show [gemname]
to see where a bundled gem is installed.
[10:12:11]~/git/bma-calabash (CAL-2855_Try_JRuby)$ bundle exec irb
2.1.5 :001 > require 'v8'
=> true
2.1.5 :002 > V8::Context.new.load('kotlib/kotlin.js')
V8::Error: ArrayBuffer is not defined
from at kotlib/kotlin.js:790:12
from at kotlib/kotlin.js:10:9
from at kotlib/kotlin.js:12:2
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
?
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.