Suggestion: Add support of BigInt for the Long values

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

User avatar
arodrigo
Posts: 24
Joined: 22 Jul 2011, 10:03
Location: Spain
Contact:

Suggestion: Add support of BigInt for the Long values

Postby arodrigo » 03 May 2018, 07:00

Hi,

Chrome already supports it, and firefox its going to add it (right know can be activated as experiment).

https://developers.google.com/web/updat ... /05/bigint

It could be awesome the possibility of use it on the long values at least as a experimental feature on the client.

Regards
User avatar
Lapo
Site Admin
Posts: 21723
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Suggestion: Add support of BigInt for the Long values

Postby Lapo » 05 May 2018, 07:22

Thanks, we'll look into it.
One problem I foresee is that JS doesn't treat numbers using the standards of other languages (C#, Java, etc...) and this can make compatibility awkward.
BigInt can partially emulate what a "long" does in C# and Java but it's arbitrarily big, while those types are limited to 64 bits.
C# and Java also supports larger numbers with types such as BigInt but I don't think these types conform to any standard. In other words they are pretty hard to convert across languages.

To avoid all these issues, and given the infrequent use of these types, we usually recommend to send them around as strings or, even better, as binary (language conversions permitting).

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 3 guests