5 ms·
From the comments here, I was expecting to find myself hopelessly out of date, and to end up with a migraine trying to parse through a mindnumbing list of chang
by Ezku 4y ago
From the comments here, I was expecting to find myself hopelessly out of date, and to end up with a migraine trying to parse through a mindnumbing list of changes. Turned out I was mistaken.
> Me: oh, cool, they fixed so many tiny things I had bumped up against
> Some others: oh no, why are things changing
I'm not getting it. Maybe I'm reading this wrong, but to me these seem pretty obvious small issues to smooth over.
- HeavyFeather 4y agoDevelopers love hating on JavaScript, on change, and on "complexification." This is all of the above. The first comment I read after yours is literally "I hate how much programming languages change"
- dayvid 4y agoThe big hurdle is a lot of new jargon that sounds more complicated than what it's doing.
- klodolph 4y agoAgreed. My main complaint is that some of these changes don’t filter down fast enough for my liking, because I’ve bumped into the issues they fix, often enough. That, and for various reasons, it’s easy to use "import" everywhere in browser-side code, but painful to use "import" in Node. That’s a major selling point for ESBuild in my mind—I can avoid dealing with Node as much.
- parentheses 4y agoThe way JS/TS change _feels_ a lot more haphazard. For example why introduce a new method to support negative indexing. Supporting `array[-1]` instead of `array.at(-1)` would mean one less thing to remember. Many of the changes make the language feel like a hodge podge made from parts of other languages. This lack of cohesion is IMO what makes upgrading the language always feel like moved cheese.
- connor4312 4y agoBecause your example is a breaking change, and breaking changes are hard to make in a runtime that needs to reasonably support two decades worth of web content. For example, if you have a `binarySearch` function that returns -1 if an element isn't found, a developer might do something. `const result = arr[index]; if (result !== undefined) { ... }`. This would then start returning the last element instead of undefined at that index.
- syg 4y agoExactly right. `arr[-1]` means `arr["-1"]` and already does something.
- conaclos 4y agoIt is also a breaking change to use new syntax and functions since old browser does not support new features. In this perspective `arr[-1]` seems a fair breaking change.
- zeven7 4y agoNo, because changing browsers to interpret `arr[-1]` as `arr[arr.length - 1]` breaks existing sites that expect `arr[-1]` to be interpreted as `arr['-1']`: That is, the value stored on object `arr` at key name '-1'. Changing browsers to interpret `arr.get(-1)` as `arr[arr.length - 1]` doesn't affect any old code using `arr[-1]`. It's not about supporting old browsers. It's about supporting old code.
- code-e 4y agoI think you're confusing your application with the language itself. Adding new syntax and functions to the language is not a breaking change. Old code will continue to work. If you start using these new features in your application, and it no longer works on old browsers, then sure that's a breaking change. But that's a choice for you to make. The language is still backwards compatible.
- 4y ago
- pjmlp 4y agoWhen I look at clever TypeScript, I always think the code was written by either Haskell or C++ template metaprogramming refugee, and this isn't good for the longevity of the language, see what happened to Scala's adoption because of it.
- yamtaddle 4y agoYeah, this is why I wince every time TS gets another feature. IMO it was entirely good enough for what it does quite a while ago. No need to add more—that's purely introducing risk (of the language's ecosystem getting worse, mainly) from my perspective.
- arnorhs 4y agoOn the contrary, many of the new TS features over the last year or more have been around making type inference smarter and allowing for less explicit typing
- eyelidlessness 4y agoYep! Or making type checking safer (this list is enormous), or better aligning TS specifics with how JS is actually used (upcoming 5.0 getting import specifiers more or less right as a great example).
- whizzter 4y agoWhile I'm an C++ refugee, most of the "clever" TS stuff I write is due to JS framework idioms creating duplicate work(redux-reducer typings...) or forcing 'any' escape doors to the degree TS use doesn't help. Doesn't mean I'm "above" using any escape hatches where appropriate though or keeping things "dumb" (most of my TS code is fairly monomorphic).
- canadianfella 4y ago[dead]
- 4y ago
- myhf 4y agoYeah, the language changes seem pretty minor and incremental. I think the more interesting changes in the last few years have been with engines. All major browsers now support ESM modules and custom elements.