Proposal for new floating point and integer data types
warcraftthreeft at sbcglobal.net
Sun Oct 27 02:45:14 PDT 2013
On Sun, 10/27/13, Domenic Denicola <domenic at domenicdenicola.com> wrote:
Subject: RE: Proposal for new floating point and integer data types
To: "Rick Waldron" <waldron.rick at gmail.com>, "Brandon Andrews" <warcraftthreeft at sbcglobal.net>
Cc: "es-discuss at mozilla.org" <es-discuss at mozilla.org>
Date: Sunday, October 27, 2013, 12:18 AM
presented in convenient video form at
(I'm not sure how to replay to these. I see people bottom posting usually. Not overly familiar with mailing lists, so I hope this works).
Woah, I didn't see that video when I was searching. (Finding a bunch searching for ECMAscript 7 and 8 and simd now). That's exactly the direction I was hoping JS would go. I was actually typing up SIMD types, but removed it as it seemed too much to request. If they're willing to add all the types and the operators with swizzling support that would probably make JS nearly perfect for computing. (I have a few projects I did in the past which could have used it). I found a gist where someone wrote of a proposal apparently https://gist.github.com/jensnockert/7a0f6a99a0f3bde2facb , looks very well thought out, even including prefetch operations which would be amazing.
Looking at his direction and slides, then single and double in my proposal would be float32, float64 which is more aesthetically similar to the other types. I'm impressed at how well thought out everything is for the future of JS.
I see the slide with the types he's suggesting. Are there types for the int8/16/32, and uint8/16/32?
var foo = 0: float32;
On slide 14 he has float32(0) indicating something like the following (or using the literal syntax):
var foo = float32(42);
I was worried about suggesting something like that for compatibility with old code, but if that's the direction and has no issues, then it's perfect. I just realized that Brendan Eich created JS so I assume he fully knows about any compatability issues. His solution is cleaner for conversions.
With what he's proposing how do you perform a bitwise conversion from uint64 to a float64? I think the norm right now is to use the typed array spec with views for 32-bit conversions. (It comes up in a few problems). I assume they're adding Uint64Array and Int64Array with his proposed changes which would provide a solution for the bitwise conversion.
I think strong typing would be a really good idea with all of these types flying around. Found a few posts Brendan Eich made about strong typing. Can't figure out how he feels about that. Would static typing ever work for JS? Kind of like a "use static"; with proper all or nothing compilation?
More information about the es-discuss