4 ms·
Are you going to push for records and tuples? Eich was pushing for them in 2011 and they still haven't arrived. https://brendaneich.com/2011/01/harmony-of-my-
by hajile 5y ago
Are you going to push for records and tuples?
Eich was pushing for them in 2011 and they still haven't arrived.
https://brendaneich.com/2011/01/harmony-of-my-dreams/ https://brendaneich.com/2011/01/harmony-of-my-dreams/
- frutiger 5y agoHe doesn’t need to, the authors of the proposal are on the committee and are planning to see it through. The proposal is humming along through the stages at a good pace.
- lucacasonato 5y agoExactly. I am very much in favor of them though. They would be a great addition to the language.
- BrendanEich 5y agoYes, Bloomberg has a big JS investment due to the Terminal (20MLOC of JS last I heard) and they have employed the records and tuples champions.
- adamddev1 5y agoOr how about TCO (tail-call optimization)? Please pretty please!
- lucacasonato 5y agoTCO is something that specific JS engines need to implement. It is implemented in JSC (Safari), but not in V8 or SpiderMonkey. Also see https://v8.dev/blog/modern-javascript#proper-tail-calls https://v8.dev/blog/modern-javascript#proper-tail-calls. As this is an engine feature rather than a spec thing, there is nothing me (or any other TC39 delegate) can do.
- adamddev1 5y agoOh yes, I see, that's true. Thanks for the explanation.
- hajile 5y agoProper tail calls are ALREADY part of the spec. Google and Mozilla simply chose to ignore the spec.
- Scarbutt 5y agoMore like Google, Mozilla just waits to see if Google is going to implement it since they can't think for themselves.
- adamddev1 5y agoIt would be so nice to have it though! It could do a lot popularize recursive problem-solving and function writing, without having to go into modifying these functions to make them stack-safe.
- brundolf 5y agoI haven’t read the full post, but what’s the benefit of adding language support for records and tuples at this point? My understanding is that engines already optimize the objects/arrays version of those concepts pretty well, and TypeScript enforces the semantics on the dev side.
- Zababa 5y ago> My understanding is that engines already optimize the objects/arrays version of those concepts pretty well They don't, using libraries that guarantee runtime immutability has a heavy performance cost in JS currently.
- brundolf 5y agoBy “object approach” I just meant “making a bunch of objects with the same shape”. I’ve read that V8 can optimize these into flat structs. Is immutability part of the proposed standard? And if so, what’s the benefit over using Object.freeze?
- Zababa 5y agoImmutability is the whole point of records and tuples. You can read more about them on the proposal: https://github.com/tc39/proposal-record-tuple https://github.com/tc39/proposal-record-tuple.
- brundolf 5y agoAh so these are actual persistent data structures. Got it, that makes more sense. The use of the term "tuple" here is odd; I've only ever seen it used to describe fixed-width, non-homogenous sequences. These look more like immutable lists (though I guess they can serve both purposes).
- Zababa 5y ago> I've only ever seen it used to describe fixed-width, non-homogenous sequences. That's what they are here. Array are heterogenous in JS, and tuples are too. And since they're immutable, their size is fixed.
- dten 5y agoRecord and Tuple are actively being worked on: https://github.com/tc39/proposal-record-tuple https://github.com/tc39/proposal-record-tuple -- currently Stage 2.