Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbol descriptions don't work #43

Open
lonevox opened this issue Feb 3, 2024 · 2 comments
Open

Symbol descriptions don't work #43

lonevox opened this issue Feb 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lonevox
Copy link

lonevox commented Feb 3, 2024

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

@lonevox lonevox added the bug Something isn't working label Feb 3, 2024
@MaxNeedsSnacks MaxNeedsSnacks transferred this issue from KubeJS-Mods/KubeJS Feb 3, 2024
@MaxNeedsSnacks
Copy link
Member

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

@lonevox
Copy link
Author

lonevox commented Feb 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants