TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Future JavaScript: what is still missing?

242 pointsby scottfrover 6 years ago

68 comments

burlesonaover 6 years ago
There are some nice ideas here, but how many different ways do you need to do something? Since JavaScript has an especially high burden for backward compatibility you can’t really remove old cruft, and adding yet another way to (whatever) just makes the language harder to learn and harder to read.<p>Warts and all, one of the best things about ES5 and earlier is that the language was so simple that you could pick it up in a day.<p>The later additions have added developer convenience for sure, but at the expense of taking something simple, consistent, and very easy to read, and turning it into a complex and subtle language with a lot of redundant syntax. For example all the different syntaxes for defining a function with the subtle differences between them. And in this articles proposal - since switch doesn’t do what I want, we’ll have both switch AND case with different semantics and syntax. Ugh.<p>At this point I’d rather see an effort to deprecate cruft or standardize features over throwing in new things.
评论 #19012409 未加载
评论 #19013417 未加载
评论 #19013646 未加载
评论 #19013187 未加载
评论 #19013859 未加载
评论 #19012795 未加载
GordonSover 6 years ago
I&#x27;d like a decent standard library.<p>These days I work mainly with C#, and to a lesser extent Typescript and JavaScript - the anemic nature of the ECMAScript standard library is really jarring.
评论 #19013212 未加载
评论 #19013901 未加载
评论 #19013930 未加载
tobyhinloopenover 6 years ago
I may have overlooked it, but I want actual proper integers. Not doubles, just integers.<p>I also missed the awesome bind-operator. EG:<p><pre><code> const getFoo = () =&gt; this.foo; const bar = { foo: 1 }; console.log(bar::getFoo()); &#x2F;&#x2F; 1 </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-bind-operator" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tc39&#x2F;proposal-bind-operator</a>
评论 #19012466 未加载
评论 #19013590 未加载
评论 #19012648 未加载
评论 #19014174 未加载
评论 #19013382 未加载
评论 #19012775 未加载
评论 #19012999 未加载
danShumwayover 6 years ago
There&#x27;s some interesting stuff in here, but I&#x27;m noticing a large chunk of it is syntactic sugar.<p>Keeping the extensible web manifesto in mind, I wonder if maybe what we really want is to have some kind of standardization around transpiling code.<p>With new features like promises, we had extensive testing via user libraries before they made their way into the language. But with these kinds of syntactic features, that doesn&#x27;t seem to be happening.<p>If a feature is almost purely syntactic sugar, maybe it would make more sense for it to be supplied via a transpiler rather than being baked into the core language? Are there pain points or disadvantages to libraries like Babel that we could address via the core language instead?
评论 #19014394 未加载
评论 #19012354 未加载
a_liebover 6 years ago
As someone who teaches JS on the side, I&#x27;m literally scared of the idea of introducing another construct called &quot;case.&quot; Especially one that goes in the opposite place of where the &quot;case&quot; normally does: &quot;switch ... case&quot; vs. &quot;case ... when.&quot;<p>JavaScript is already jam packed with subtleties and gotchas that make it hard to learn, including situations where two things have the same name or the name doesn&#x27;t quite match the underlying concept: C-style &quot;for&quot; vs. &quot;for ... in&quot; vs. &quot;for ... of,&quot; object vs. Object, Object.prototype vs. &quot;the prototype of the object,&quot; etc. We don&#x27;t need another one of those.<p>I&#x27;d actually like this if it used another word than &quot;case.&quot; &quot;choose ... when&quot;, maybe? Kinda awkward, but I bet someone could think of something better. &quot;case&quot; has the nice feature that it&#x27;s already a reserved word, but it&#x27;s not valid syntax to have a variable name right next to an open brace, so the parsers could figure it out.
marcosdumayover 6 years ago
Is it just me or are those really making Javascript weirder?<p><pre><code> const func = do { let result; () =&gt; { if (result === undefined) { result = someComputation(); } return result; }; }; </code></pre> Shouldn&#x27;t that be &quot;if (result === undefined) then someComputation else result&quot;? Why import functional style and proceed to make it inherently imperative with a return in the middle of the block?<p><pre><code> obj?.foo?.bar?.baz </code></pre> The point of optional chaining is that you can place functions within the chain. That seems to be a very surprising and useless way to do them.
评论 #19012423 未加载
评论 #19014285 未加载
评论 #19012246 未加载
评论 #19013419 未加载
Mugwortover 6 years ago
Javascript is still missing simplicity, consistency and a unified core set of ideas. It will always be that way too. Javascript will always be something grudgingly accepted or used with some misgiving. ES6 has some very nice features and the good parts of javascript stand out as much as the unfortunate inconsistencies lurking inside the language. People know how to use it. Some use it quite well but I always get the feeling I have to step around carefully and not make a dumb mistake in js which is easier to do than almost any other language except say PHP. Web assembly should open up some badly needed possibilities. All we really need is a consistent API. A world without js? I hope so.
评论 #19014928 未加载
评论 #19015135 未加载
genezetaover 6 years ago
I was tempted to cite Antoine de Saint-Exupéry&#x27;s quote on perfection, but we all know that, right?<p>But then again, even the author mentions at the beginning the &quot;risk of adding too much&quot; and, well, I wonder if this has not already happened to JavaScript.
评论 #19013194 未加载
评论 #19013527 未加载
danShumwayover 6 years ago
I feel like there&#x27;s something I&#x27;m missing with do expressions. Are they purely syntactic sugar? What can I do with a do expression that I can&#x27;t do with an immediately invoked anonymous function?<p>The examples the article gives don&#x27;t really look all that syntactically different to me.<p><pre><code> const func = (() =&gt; { let result; &#x2F;&#x2F; cache return () =&gt; { if (result === undefined) { result = someComputation(); } return result; } })(); const func = do { let result; () =&gt; { if (result === undefined) { result = someComputation(); } return result; }; }; </code></pre> And I guess I wouldn&#x27;t be able to recurse in a do expression like I can with a named function? So it&#x27;s not like I can actually universally stop using immediately invoked expressions everywhere.
评论 #19012761 未加载
评论 #19012481 未加载
评论 #19012297 未加载
enobrevover 6 years ago
A lot of great and well-thought-out suggestions here. Whenever taking deeper dives into Javascript, I tend to find myself on 2ality.com though google searches and whatnot. They do well when it comes to breaking down the language and features.<p>I&#x27;m a fan of 2.2: destructuring switch, although I occasionally employ something similar in JavaScript and other languages with a `switch` statement:<p><pre><code> const resource = await fetch(jsonService); switch (true) { case resource.status === 200: console.log(`size is ${resource.headers[&#x27;Content-Length&#x27;]}`); break; case resource.status === 404: console.log(&#x27;JSON not found&#x27;); break; case resource.status &gt;= 400: throw new RequestError(res); break; } </code></pre> It&#x27;s missing the destructuring aspect, so the first case is a bit more verbose, and I imagine there&#x27;s better potential to optimize something like the OP&#x27;s example. But it has a similar effect to the example and works today.<p>Slightly related: I really wish `case` worked with brackets instead of break, similar to OP&#x27;s example. It looks cleaner and is easier to visually parse. I suppose that&#x27;s only better if you prefer brackets (which I do).
PretzelFischover 6 years ago
I would like a null conditional operator and null coalescing operator.<p>return data?.error?.message ?? &quot;no error&quot;;<p>Also pattern matching would be a big win.
评论 #19012472 未加载
评论 #19028688 未加载
评论 #19012470 未加载
alexandercrohdeover 6 years ago
What&#x27;s really missing from javascript?<p>1. The ability to run my code without transpiling and reinstall dependencies for 10 minutes.<p>2. The ability to know which of the last 5 version of javascript to use.<p>3. Stability in my dependencies.<p>4. Consolidation and standardizing on established frameworks.<p>Basically undoing all the mess the ecosystem has done over the last 8 years.
评论 #19017268 未加载
scarface74over 6 years ago
I know it will never happen, but something like LINQ in C#. Not just functions that iterate over collections, but the whole idea of language integrated queries where code is turned into expression trees that can be parsed and translated by providers.<p>For instance in C# you can take the same LINQ expressions and they can be translated to sql by EF or MongoQuery by the Mongo driver at runtime.
评论 #19013115 未加载
bchernyover 6 years ago
As an aside, I’m not seeing any novel features in this list. All of them seem to be borrowed from other languages (Swift, F#, Haskell, ...).<p>With enough of this, at what point will all languages start to look identical (Youngme Moon calls this “homogeneous heterogeneity”)?<p>And how often does a language come along that introduces something truly new, rather than porting an idea from another popular language?
评论 #19013099 未加载
评论 #19012739 未加载
评论 #19012732 未加载
c-smileover 6 years ago
Here are things that I&#x27;ve added in Sciter&#x27;s script (<a href="https:&#x2F;&#x2F;sciter.com" rel="nofollow">https:&#x2F;&#x2F;sciter.com</a>):<p>&#x27;like&#x27; operator that is used as a match<p><pre><code> if( obj like &#x2F;[A-Z]&#x2F;g ) … &#x2F;&#x2F; &quot;string&quot;.match if( obj like {name:String} ) … &#x2F;&#x2F; obj has name string field if( obj like [String,Object] ) … &#x2F;&#x2F; obj is an array of at least two elements, string and object. </code></pre> extended switch() :<p><pre><code> switch(obj) { case 1: … &#x2F;&#x2F; standard JS like &#x2F;[A-Z]&#x2F;g: … &#x2F;&#x2F; RegExp, Object, Array match instanceof cls: … &#x2F;&#x2F; obj instanceof cls in [1,2,3]: … &#x2F;&#x2F; obj }</code></pre>
评论 #19012650 未加载
评论 #19012888 未加载
评论 #19012931 未加载
seniorsassycatover 6 years ago
1.1 Comparing objects by value I _think_ I&#x27;d prefer a standard `equals` method, or more likely a `[Symbol.equals]` method. With `[Symbol.equals]` and `[Symbol.hash]` we could also build collections for objects.
igotsideasover 6 years ago
After messing with Elixir for a while, i really enjoyed the piping feature. I’m sure it will be added to js and I’m genuinely excited cause it makes reading code easier for me, given that your function names tell you what the function does
h1dover 6 years ago
I wish more languages follow the sense of being fun to code like ruby.<p>[1, 2, 3] - [1, 3] #Yields [2]<p>The code is readable, intuitive and short yet many languages never have this simplicity.<p>JS example. <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;1187518&#x2F;how-to-get-the-difference-between-two-arrays-in-javascript" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;1187518&#x2F;how-to-get-the-d...</a>
评论 #19013680 未加载
评论 #19013707 未加载
_yawnover 6 years ago
What we really need isn&#x27;t more syntax, it&#x27;s core features like threads, operator overloading, a large std library, some real form of serialization (JSON doesn&#x27;t come close to counting), etc.
评论 #19012914 未加载
评论 #19012238 未加载
评论 #19012435 未加载
jillesvangurpover 6 years ago
IMHO the list of changes presented here sort of half way gets you there to the (apparently) platonic ideal of being more swift or Kotlin like. It&#x27;s better but seems a bit lacking in ambition because of backwards compatibility.<p>I&#x27;d argue backwards compatibility is actually a lot less important in the JS world than it currently appears to be. Why not aggressively deprecate all the uglyness, broken semantics, etc. If you write ES 2020, or whatever they will call it, why would you still want broken floating point math, wacky equals behavior that nobody can explain with a straight face, etc. Just deprecate it, start disallowing it, and eventually remove it from the language in a couple of versions.<p>Browser javascript is effectively a compilation target these days. Yes you can write in it directly but many people don&#x27;t do that. Transpilers seem to be the norm these days. Mostly transpilers already do work around javascript legacy but they still have to deal with hiding some of the ugliness.<p>The good news is that people update their browsers. So there is very little need for transpilers to be able to target old versions of browsers. Mostly they just need to deal with current and recent versions.<p>With the emergence of WASM, that is becoming a more obvious compilation target. You can already run C, Kotlin, Rust, Code, etc. using it. Doing so, you bypass all of the legacy of javascript. It&#x27;s just another compilation target for compilers.<p>It&#x27;s not such a big leap to simply run javascript interpreters&#x2F;vms on top of WASM as well. Why not? It&#x27;s not any different from doing the same with ruby or python. It would be a great way to support legacy applications and it completely removes the need for javascript to continue to support legacy features. IMHO, it would greatly simplify browser implementations if all they had to do is support running WASM + whatever standardized bindings they ship for things like the DOM, browser storage, webgl, etc.<p>You could freeze a current version of v8, call it legacy js and use that to run legacy javascript if&#x2F;when you actually need it and rely on a modern JS interpreter without any of the baggage. My guess is that running legacy js would very rapidly become a niche thing.
Waterluvianover 6 years ago
A built-in way to conveniently iterate n times.<p>Anyone have a sensible pure JavaScript example for:<p><pre><code> range(5).forEach(fn) </code></pre> I haven&#x27;t found one that felt small enough to use inline. It end up using traditional for loops.
评论 #19013079 未加载
评论 #19013052 未加载
评论 #19013060 未加载
评论 #19013049 未加载
int_19hover 6 years ago
For value equality, I feel like the whole value&#x2F;reference type distinction is an unnecessary distraction. What we really need is different <i>operators</i> to handle object identity comparisons and value comparisons. Whether an object can be meaningfully compared by value to another object is orthogonal to whether it&#x27;s a value type or not - e.g. arrays are reference types, but there&#x27;s no reason why any two arrays can&#x27;t be compared element-by-element.<p>One language that gets it mostly right is Python, where &quot;==&quot; always compares values, and &quot;is&quot; always compares references. Thus, you can use either for e.g. lists and sets, depending on what you actually need at any given time. However, Python fails in that it doesn&#x27;t give the same flexibility in many contexts where the comparisons are implicit - e.g. in dicts and sets (it always uses ==, instead of letting the user specify an equality function).<p>Ironically, a language that gets it fully right - including the standard library - is VB.NET.<p>I&#x27;m not even sure that value types themselves are such a useful concept. A value type can be thought of as an immutable reference type, where any mutations done via the reference simply cause a new object to be created and the reference changed (semantically; under the hood, it can be easily optimized down to in-place update).
pmontraover 6 years ago
In this code please remove the when keyword if possible. It&#x27;s only noise. The Elixir equivalent works well without it. Other than that I&#x27;d love that kind of pattern matching on JavaScript.<p><pre><code> case (resource) { when {status: 200, headers: {&#x27;Content-Length&#x27;: s}} -&gt; { console.log(`size is ${s}`); } when {status: 404} -&gt; { console.log(&#x27;JSON not found&#x27;); }</code></pre>
评论 #19017178 未加载
jcofflandover 6 years ago
Reminds me of this quote:<p>“Perfection is achieved when there is nothing left to take away.” --Antoine de Saint-Exupéry<p>This principal should be applied more to programming languages.
nudpiedoover 6 years ago
why no one proposes as feature a header to make javascript strict with the newest standard and deprecate and drop compatibility from previous versions in the newer ones?<p>Or even just complete support for asmjs with interop and program in completely other languages, especially since the person who wrote this seems to want to program in languages with different semantics...
评论 #19012353 未加载
评论 #19012220 未加载
评论 #19012326 未加载
评论 #19012344 未加载
_bxg1over 6 years ago
Much of this reads like the author wants JavaScript to be something it isn&#x27;t. The requests for compare-by-value data structures, immutability, and true concurrency are huge paradigm shifts from the heart of the language whose implementation would no doubt come with significant complexity overhead.
评论 #19012626 未加载
benbristowover 6 years ago
I&#x27;d like to see guard clauses. Don&#x27;t know how they&#x27;d be implemented though.
reconbotover 6 years ago
I love these proposals and while it probably makes sense for me to learn more about the languages that already implement it there&#x27;s no denying that having them in JS is a win. =)<p>I wish I knew about python&#x27;s [itertools](<a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;itertools.html" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;itertools.html</a>) before I started making [streaming-iterables](<a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;streaming-iterables#api" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;streaming-iterables#api</a>) for example.
TravelTechGuyover 6 years ago
Not sure if it had been mentioned already, but I think we could benefit from cancellable Promises.<p>Many of the modules and libraries currently support Promises, and `async&#x2F;await`, but try to find a way to cancel a long-running Promise. Some libraries have resorted to using their own mechanisms, and some (e.g. `axios`) resorted to using a withdrawn TC39 proposal.<p>I&#x27;d like a standard, easy way to cancel a Promise. I know it&#x27;s not simple, and Promises can wrap around other Promises, etc. but if I&#x27;m e.g. uploading a large file to a server, there should be an easy way to provide my users with a &quot;cancel&quot; button that works.
评论 #19014012 未加载
ameliusover 6 years ago
Simplicity and elegance
评论 #19014922 未加载
评论 #19015941 未加载
sebringjover 6 years ago
Types :) I tend to use underscore for just _.get or _.set these days as I have most everything else I want so having some built in way to do that would be nice but the elephant in the room here is the toolchains being built quietly behind the scenes that support web assembly from strongly typed languages with much better load times and performance. The WALT one and the oCaml React one is pretty cool but would be nice if there was an official strong-typed JavaScript version for this scenario being built as a spec.
评论 #19013368 未加载
luordover 6 years ago
Entirely off-topic (or maybe not given the nature of like 20% of the comments here), but it&#x27;s getting seriously annoying how in <i>every</i> thread even tangentially related to programming there are ten or so people (not the same people, not trying to call anyone out) trying to proselytize about functional programming and&#x2F;or static typing.<p>They&#x27;re <i>not</i> panaceas, they&#x27;re just alternative approaches to programming no worse nor <i>better</i> and they don&#x27;t need to be brought up in every. Single. Post.
评论 #19015287 未加载
austincheneyover 6 years ago
JavaScript still is often extended via inheritance, such as classes and modules. This is unfortunate because inheritance is the opposite of simple, putting things together instead of taking them apart.<p>One addition that could greatly improve simplicity is assignable blocks. A block provides scope, much like a function, but accepts no input and returns nothing. Most functions I write take no input and return undefined because I only need them for code reuse by reference.<p>Imagine code like this:<p><pre><code> if (expression) myBlock else otherBlock;</code></pre>
评论 #19015266 未加载
devwastakenover 6 years ago
Renderer access. It should be possible for js to control and get callbacks for rendering and event updates in styling. Though that&#x27;s a browser feature, not really js
评论 #19015154 未加载
pfootiover 6 years ago
I&#x27;d like to see a real, useful implementation of weak references, for use in value caches, or a way to manually take over garbage collection for some objects.<p>Basically if I want to keep a cache of expensive objects that will grow monotonically, I need to do a lot of work to make sure I&#x27;m not leaking memory right now, but if I could instead store in a Map&lt;string, weakref&gt;, it&#x27;d be much easier, things could go out of ref and I could deal with that.
评论 #19012424 未加载
mschuetzover 6 years ago
The single most important feature I&#x27;d like to see in JS are types. Typescript seems nice but I don&#x27;t want to need a transpiler, especially since I&#x27;m doing a lot of live-coding in JS and compilation&#x2F;transpilation times &gt;50ms are already too much.<p>Other than that, JS could benefit tremendously from a more complete standard library, and a build system, including a file watcher, that doesn&#x27;t rely on 200 nonsensical dependencies.
评论 #19013342 未加载
louthyover 6 years ago
Type safety
评论 #19012336 未加载
hsavit1over 6 years ago
If Apple is indeed granted the patent on Swift&#x27;s optional chaining (as was recently posted <a href="https:&#x2F;&#x2F;forums.swift.org&#x2F;t&#x2F;apple-is-indeed-patenting-swift-features&#x2F;19779" rel="nofollow">https:&#x2F;&#x2F;forums.swift.org&#x2F;t&#x2F;apple-is-indeed-patenting-swift-f...</a> ), we wouldn&#x27;t see this in future Javascript, would we?
评论 #19012284 未加载
评论 #19012162 未加载
评论 #19012440 未加载
评论 #19012269 未加载
评论 #19012144 未加载
superasnover 6 years ago
I wish JavaScript would let me declare scoped variables inside if statements like this:<p><pre><code> if (let myVar = exp) {</code></pre>
评论 #19012593 未加载
defnotarobotover 6 years ago
As someome who has spent the last year primarily with Elixir, it is impossible to overstate how nice pipeline |&gt; is.<p>It is one of the most convenient and readable pieces of syntax, and one of the primary reasons I pause before using javascript instead of Elixir in a given moment.
jkbbwrover 6 years ago
The biggest thing that is missing in my experience is finalizers or context blocks. I need some way to free resources allocated inside emscripten. Either python style context managers or go style defer or c++ style destructors on scopes would be a god send.
zzo38computerover 6 years ago
Some things I wanted in JavaScript is a goto command, and macros. They mention objects to compare by value, and I had a bit different idea which is a UserPrimitive function which has a similar meaning (but different; user primitives would also allow some degree (but still restricted in some ways) of operator overloading).<p>Bigint is a good thing they added. Sometimes you need to deal with 64-bit integers, and other times you might want unlimited range, so that helps. However, some operations that are not currently built-in perhaps should be in order to be more efficient, such as log2 of bigint numbers or counting trailing bits.<p>A built-in RegExp.quote() function is another thing (although it is easy to make, it seem to me it is something that ought to be built-in).<p>If macros are implemented, then many features can be done by macros and do not need to be built-in features.<p>One feature of JavaScript that I dislike is automatic semicolons.<p>And yet, many proposals (including these) may be rejected if better ways are found.
blitmapover 6 years ago
The only thing I absolutely hate is the import-as bullshit inspired by Python. I was told this was to assist static analyzers, but when you compare it to destructuring syntax you just get annoyed by the duplication.<p>+1 for pipeline operator +1 for a destructuring switch
vertline3over 6 years ago
I like JS, I like the new features since es5, although I liked es5 also, I notice that the updates are now yearly it seems, which is mostly good since there was maybe a long delay in the past, but can be bad if there become too many features.
stevedekorteover 6 years ago
Coroutines (unlike async&#x2F;await) would allow one to wait on an async result without losing the stack which is waiting. This would avoid the need for (often) inscrutable callback state machines (Javascript&#x27;s version of GOTOS).
评论 #19015261 未加载
paulie_aover 6 years ago
Not having to install the shit show of conflicting dependencies. Get a formal package manager instead of the twenty different ones. Basically take a look at python and realize the js ecosystem could actually have nice things.
renke1over 6 years ago
Save navigation and equals&#x2F;hashCode (as protocol, not using that ValueType thingy) are fine and definitely useful, but otherwise we should avoid adding even more syntax elements to JS.
servercobraover 6 years ago
I would love some of the syntactic sugar from Swift. Swift&#x27;s `guard` and `if let`, along with the nil coalescing mentioned in another comment make Swift a joy to write.
jorblumeseaover 6 years ago
I know this is a really contentious idea but I&#x27;d like javascript and typescript to merge into the same language. Type safety is the huge 800lb gorrilla in the room.
评论 #19017262 未加载
pcmaffeyover 6 years ago
&gt; Comparing objects by value<p>A handy helper I use all the time for this:<p><pre><code> export const jsonEqual = (a, b) =&gt; JSON.stringify(inspect(a)) === JSON.stringify(inspect(b))</code></pre>
adrianhelover 6 years ago
I would like optional typing for the few places where it would be very useful. But people would enforce all types way too much, so I&#x27;m kind of on the fence.
z3t4over 6 years ago
Please stop adding new syntax, it only makes the language uglier. Instead of a special syntax for comparing objects, just add a function to Object.prototype.
评论 #19014386 未加载
Findetonover 6 years ago
I&#x27;m implementing delta JSON mutations. I think with time people will embrace the idea.
8bitsruleover 6 years ago
Python writes to <i>local</i> files using native function <i>open</i>. Javascript has no native function. Because...?<p>We can open a window, write arbitrary text to it, use the browswer to &#x27;Save as...&#x27;. Close but no cigar.<p>I&#x27;d like to use JS for a lot more than the web. MS Basic wrote user-entered text to a file 40 years ago.
评论 #19014700 未加载
stephenrover 6 years ago
Really? Still no way to specify argument types?
评论 #19013062 未加载
IloveHN84over 6 years ago
Type safety, without using Typescript
rpzover 6 years ago
&gt;1 2 3 + 3 4 5<p>4 6 8<p>Extend the operators to work on lists!
评论 #19014934 未加载
topynateover 6 years ago
Dependent types. You think I&#x27;m joking, but check back in ten years...
pragueexpatover 6 years ago
Deep clone objects
madmaniakover 6 years ago
ES5 &gt; ES6+
amiga-workbenchover 6 years ago
Developers with pragmatism and taste.
AnyTimeTravelerover 6 years ago
A sane and coherent dependency structure?
tomerbdover 6 years ago
static typing
_blrjover 6 years ago
Restraint.
jenscowover 6 years ago
A viable replacement.
评论 #19012491 未加载
评论 #19014273 未加载
评论 #19012551 未加载
评论 #19012328 未加载
ameliusover 6 years ago
A reference implementation in a purely functional language.
评论 #19012578 未加载
JustSomeNobodyover 6 years ago
Needs more punctuation. I don’t know about the rest of y’all but I get disappointed when I look at JavaScript and it’s not awash in a sea of angle brackets.<p>But seriously, be careful not to ruin it with too much “I need this!”
alan_nover 6 years ago
I was scrolling through this and I was like, where is optional chaining? Then when he gets to it, he&#x27;s a bit against it because it&#x27;s easy to write bad code. What? People still do nested checks like this all the time! It&#x27;s not changing anything beyond making them more readable and I think more obvious when you think something might not exist (e.g. `some.very?.nested?.property` vs `some.very.nested?.property`). Sometimes it&#x27;s not so much the nesting that makes it unreadable either, but that you&#x27;re checking multiple objects, imagine writing `some.nested?.property &amp;&amp; other.nested?.property`.<p>It&#x27;s like saying promises shouldn&#x27;t have been added because you can still write bad code with them and create nested promise hells ( I sure did when I first learned them). Isn&#x27;t it better to say, no, best practice is to add ? only where you actually need them. The solutions he cites are not really solutions, they&#x27;re just abstracting the problem away which most of as already do, but then the abstraction becomes hard to read because those checks have to be somewhere.<p>Worse I think is the comparing objects by value idea. I think it would be way too easy for beginners to reach for that solution. There are often better work arounds, it&#x27;s quite rare imo to need to do a deep nested check of two objects that could be very different (i.e. contain different properties). Plus it&#x27;s not like using a helper function is that verbose and a custom one can be really fast (if both objects contain the same properties, creating a function that &quot;manually&quot; checks for them all is blazing fast), same thing with deep clones.<p>Things I would really like, from most to least: optional chaining obviously, realms, pipeline operator, optional type checking, and enums (you can sort of fake them though, hence why they&#x27;re last)
评论 #19013375 未加载