Rhino

Rhino

34M Downloads

Symbol descriptions don't work

lonevox opened this issue ยท 2 comments

commented

Minecraft Version

1.20.1

KubeJS Version

2001.6.4-build.130

Rhino Version

2001.2.2-build.18

Architectury Version

9.1.12

Forge/Fabric Version

Forge 47.2.17

Describe your issue

Take the following code from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/description:

console.warn(Symbol('desc').description)
// Expected output: "desc"
console.warn(Symbol.iterator.description)
// Expected output: "Symbol.iterator"
console.warn(Symbol.for('foo').description)
// Expected output: "foo"
console.warn(`${Symbol('foo').description}bar`)
// Expected output: "foobar"

console.warn(Symbol.keyFor(Symbol.for('foo')))
// Expected output: "foo"

In a script, this gives the following output:
image
Only console.warn(Symbol.keyFor(Symbol.for('foo'))) has the expected output.

It's worth noting that the symbols do exist and can be printed:

console.warn(Symbol('desc'))
console.warn(Symbol.iterator)
console.warn(Symbol.for('foo'))

The above code gives:
image

Crash report/logs

No response

commented

I'm unsure if Lat wants to fix this since the functionality of symbols isn't... particularly useful within an MC context, but I transferred it to the Rhino repo regardless

commented

I'm using it for enums, as using Symbols is how I'd normally make enums in JS