node-gtk icon indicating copy to clipboard operation
node-gtk copied to clipboard

BigInt-related API fixes and non-breaking changes

Open mildsunrise opened this issue 4 years ago • 5 comments

BigInt-related API fixes and (for now, only) non-breaking changes.

  • input conversions for BigInt:

    • all integer types (8, 16, 32, 64) now accept bigint and number

    • 64-bit integer types ([u]long, [u]int64, gtype) now convert the value to BigInt and then call [U]Int64Value()

      (the other integer types still convert to Number first, which means IIRC that if an out-of-range BigInt is passed, they'll get converted to trash rather than the low bits, as the user would expect. but it's better for performance and user can just & 0xFFFFFFFFn)

  • GType consistency (these are breaking, but very little used so I think a fix like this is justified):

    • GValueToV8 now converts GType to BigInt to be consistent
    • GTypes only support conversion from BigInt now
  • I've also annotated the places that should be changed to completely support BigInt, but would be a breaking change.

  • other non-BigInt related fixes:

    • add missing entries for [u]int64 in CanConvertV8ToGValue

mildsunrise avatar Apr 20 '21 01:04 mildsunrise

You can include the breaking changes here directly, I'll release 1.0 right after it's merged.

romgrk avatar Apr 20 '21 01:04 romgrk

hmm I would wait a bit before the breaking release, just in case there are more breaking changes we haven't discovered yet? either way, +1

mildsunrise avatar Apr 20 '21 01:04 mildsunrise

The breaking changes need to land on master anyway, even if we wait before the release. You can add them here directly, it will be simpler.

romgrk avatar Apr 20 '21 18:04 romgrk

Perfect, done. This seems to be working but I'll test it some more to make sure.

mildsunrise avatar Apr 21 '21 11:04 mildsunrise

(note to self: parts of this PR have been merged as #301 and #322... I should take those out and rebase)

mildsunrise avatar Mar 10 '22 14:03 mildsunrise