I assumed that Google had added special code to handle integers over
32 bits and wasn't relying on the built-in JS Number code for that.
The spec states that Dart has no limit to the number of bits in a number.
I also assumed that a Dart program should run identical on the Dart VM as on Dart JS.
I will file a bug. Thanks for your response.
The challenge is that it's incredibly hard if not impossible to get good performance in JS if you do that. The trade-off is you can have fast code that fits within JS's numeric limitations or you can have slow code that's correct if you go over (I think?) 53 bits or whatever JS guarantees.Our hunch is that the vast majority of the code you'd run in a browser doesn't exceed that limitation anyway, so it's better to be fast.
On Mon, Nov 7, 2011 at 3:57 PM, Bob Nystrom <rnys...@google.com> wrote:The challenge is that it's incredibly hard if not impossible to get good performance in JS if you do that. The trade-off is you can have fast code that fits within JS's numeric limitations or you can have slow code that's correct if you go over (I think?) 53 bits or whatever JS guarantees.Our hunch is that the vast majority of the code you'd run in a browser doesn't exceed that limitation anyway, so it's better to be fast.That may be, but the problem is when it is silently wrong.
If I write a financial application in Dart, right now I cannot use the built-in arbitrary precision and have to write my own in Dart (not making use of the functionality in the VM), which will be massively slower and take more memory. I do not think this is an acceptable situation, but the Frog guys have stated they believe they can achieve fully spec-compliant ints with acceptable performance.
If this turns out not to be the case, I will again push for separating bigint from int so that only those uses that actually need arbitrary precision will pay for it, and so that there is one language which behaves according to spec (changing the spec as necessary) across all implementations.
- bob
It introduces a mismatch between the VM type system and the Dart type system,The fact that the VM silently overflows is in my opinion very dangerous.
for the VM you have small integer and arbitrary precision integers but in the Dart type system
you have only ints.
On Mon, Nov 7, 2011 at 5:36 PM, Rémi Forax <fo...@univ-mlv.fr> wrote:
It introduces a mismatch between the VM type system and the Dart type system,The fact that the VM silently overflows is in my opinion very dangerous.
for the VM you have small integer and arbitrary precision integers but in the Dart type system
you have only ints.
The VM doesn't overflow, it is a problem in the generated JS by Dartc.
--
John A. Tamplin
Software Engineer (GWT), Google