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

Represent ulong as BigInt #176

Closed
kfish610 opened this issue Apr 20, 2020 · 2 comments
Closed

Represent ulong as BigInt #176

kfish610 opened this issue Apr 20, 2020 · 2 comments
Assignees

Comments

@kfish610
Copy link

I have a ulong property in a class that I am exposing to the ClearScript engine. The only issue is that rather than being capped at ulong.MaxValue, it is being capped at the js number max value, 2^53 - 1. I'm wondering if there's some way to represent the property as a BigInt in js, or to allow it to be set to a BigInt, as right now it gives an Error: Invalid property assignment if I attempt to.

@ClearScriptLib
Copy link
Collaborator

Hi @kfish610,

ClearScript has no support for BigInt at the moment. Even worse, since BigInt is a primitive rather than an object type, there's no way to marshal it to the host.

The only thing you can do right now is expose a property that returns the value as a string, and parse it into a BigInt in script code. Sorry!

We'll add BigInt support in the next ClearScript release.

Thanks!

ClearScriptLib added a commit that referenced this issue May 29, 2020
…; added JavaScriptExtensions.ToTask (GitHub Issue #182); added DocumentLoader.MaxCacheSize and DocumentCategory.MaxCacheSize; added code to break event connections on engine disposal (GitHub Issue #183); improved ES6 module support, fixing cycle crash (GitHub Issue #181); added DynamicHostObject (GitHub Issue #180); added BigInt / BigInteger support for V8 (GitHub Issue #176); hardened Assembly.Load call in V8Proxy.cs (GitHub Issue #175); improved V8Update environment isolation to fix some V8 build issues (GitHub Issue #185); updated API documentation. Tested with V8 8.3.110.9.
@ClearScriptLib
Copy link
Collaborator

Version 6.0.2 adds BigInt / BigInteger support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants