Support BigInt conversion
Links:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt
How would you go about this? I know it would be a breaking change if node-gtk suddenly started returning BigInt values for int64, since they don't mix with numbers... but the current behaviour (silently casting to double and returning a completely different number) is also broken. Options that come to mind:
- Maybe it's feasible to release a major version soon?
- We could start returning BigInt, but just in cases where the number can't be represented by a double.
If this breaks something, it was surely broken already, and new users would
BigInt(x)to get the good behaviour.
Maybe it's feasible to release a major version soon?
We're still pre-1.0, so we can do anything we want :smile: Joke aside, yes, and it would be nice to have a major release, so people can rely on a stable API. TBH I've been reticent to publish a 1.0 because I wasn't confident enough in this being production-ready, OTOH the issues can be communicated clearly in the readme.
We could start returning BigInt, but just in cases where the number can't be represented by a double. If this breaks something, it was surely broken already, and new users would BigInt(x) to get the good behaviour.
Very sensible behavior, it indeed makes sense that people are forced to migrate away from a broken implementation.
So sure, as soon as BigInt conversion is implemented for the remaining types (GTypes are already converted as BigInt) we can release a 1.0.
Good to know, I'll keep it in mind. Let's see if I have time to work on this...
I'd be happy to have another contributor ^^
AFAICT, all the changes that would be needed would be in value.cc, which is where we do all our conversions, plus updating the failing tests (or adding some if nothing fails).