You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some modules in RingoJS (binary, io, ringo/events) use defineClass() which modifies the global scope. In itself that's imho quite intransparent and thus not a good idea, but alas the wrong implementation of const in Rhino leads to another problem: requiring one of these modules in conjunction with const and desctructuring assignments fails with eg. TypeError: redeclaration of var ByteArray.
Module test-a.js:
require("binary");
require("test-b");
Module test-b.js:
const {ByteArray} = require("binary");
Afais Rhino walks up the prototype chain (the global scope is the prototype of all module scopes) and tries to re-declare the const ByteArray in there, which correctly fails - but i couldn't figure out why the const isn't declared in the module scope.
Workaround: use const binary = require("binary"); in modules. Adds verbosity, but works.
The text was updated successfully, but these errors were encountered:
Some modules in RingoJS (
binary
,io
,ringo/events
) usedefineClass()
which modifies the global scope. In itself that's imho quite intransparent and thus not a good idea, but alas the wrong implementation ofconst
in Rhino leads to another problem: requiring one of these modules in conjunction withconst
and desctructuring assignments fails with eg.TypeError: redeclaration of var ByteArray.
Module
test-a.js
:Module
test-b.js
:Afais Rhino walks up the prototype chain (the global scope is the prototype of all module scopes) and tries to re-declare the const ByteArray in there, which correctly fails - but i couldn't figure out why the
const
isn't declared in the module scope.Workaround: use
const binary = require("binary");
in modules. Adds verbosity, but works.The text was updated successfully, but these errors were encountered: