Earlier quoted context omitted.
Javascript is not simple AT ALL. It has 3 ways to declare functions, multiple variations on arrow functions syntax, a weird prototyping inheritance system, objects you can create out of "new" on functions, object literals that can act an pseudo-classes, classes, decorators, for-i loop + maps + filter + for-in loop (with hasOwn) + forEach, async / await + promises and an invisible but always-on event loop, objects pro…
And ESM vs CJS. What should be an inconsequential transition, has turned into a minefield where adding a dependency to your package.json might blow up your build system, testing library or application without warning. Literally wasted weeks of my life debugging this pile of poop that is the JS ecosystem.
Proposal: JavaScript Structs
191–200 of 371 posts
Re: Proposal: JavaScript Structs
#192I feel like trying to add fast data structures into JavaScript is futile, I think at this point it would be better to make it easier for JavaScript and the browser to interface with faster languages.
The only thing I would add to JavaScript at this point is first class TypeScript support so that we can ditch the transpilers.
Re: Proposal: JavaScript Structs
#193Re: Proposal: JavaScript Structs
#194Earlier quoted context omitted.
Now that I'm thinking about it, most of it is probably .NET bloat instead of C# bloat, but a few examples would be global usings, file scoped namespaces, records, target-typed new expressions, null coalesce assignments, etc. It's nothing huge, but combined with .NET bloat it can be overwhelming when you haven't worked in .NET for a while.
and pattern matches, primary constructors, range operator, switch expressions, etc. it does add up
Re: Proposal: JavaScript Structs
#195Earlier quoted context omitted.
In fact, Javascript is so complex that one of the seminal books on it was specifically "The Good Parts", cutting down the scope of it to just the parts of the language that were considered decent and useful.
I think the distinction with JavaScript compared to other 'complex' languages is that you don't have to go beyond "The Good Parts" to achieve significant functionality, and it has become idiomatic to use the good subset. In some respects I think if there were a well defined "Typescript, The Good Parts" I would happily migrate to that. I do wonder if there will, one day, be a breaking fork of JavaScript that only remo…
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: Proposal: JavaScript Structs
#196Earlier quoted context omitted.
Java went through this too, although there, a lot of it is part of the ecosystem. See https://chrisdone.com/posts/tamagotchi-tooling/
The java tooling is the number one thing I hate about using the language. It's all just bad. Then. You get forced into using intelij because it seems to smooth over a lot of the toolings problems with "magic". It's horrible.
Re: Proposal: JavaScript Structs
#197Earlier quoted context omitted.
I've been meaning to write a longer essay on this for years, but I believe the reason for this observation is different cohorts. Imagine you are a C# programmer just as C# 1.0 is released. C# is a fairly simple language at that time (and similar to other languages you already know), so you can get caught up on it fairly easily and quickly. A few years later, C# 2.0 comes out. It's got a handful of features, but not t…
Been using .net since 2.0 and nah C# has jumped the shark. Primary constructors are a very poorly designed feature that for some reason was added in the last version. The new-ish yearly release cycle I think is mostly to blame, they feel like they need to add some headline features every year but the team also, maybe due to org-chart politics, seems to not really able to make deep runtime level changes that are neede…
A lot of stuff is also designed to be independent of library changes - IIRC for example if you use nullability, the compiler will emit the Nullable attribute's definition into your .dll as a hidden class, so that your library will work even on older versions of the runtime with older base class libraries. Doing this complicates the compiler (and adds a tiny, tiny amount of bloat to your dll) but means that more people can adopt a new feature without having to think about upgrading their SDK or runtime.
My personal opinion is that if a change can be done adequately entirely at the compiler level without runtime/library changes, it should be done there. It allows the people working on the language, libraries and runtime to iterate independently and fix problems without having to coordinate across 3 teams.
Re: Proposal: JavaScript Structs
#198Earlier quoted context omitted.
I don't think R&T will ever ship at this point, since the browser vendors are apparently unwilling to absorb the complexity that would be required to add new primitive types with value semantics.
I've been following that proposal closely, and even (unsuccessfully) tried to contribute suggestions to it. I think what's killing it is that the authors of the proposal won't accept arbitrary values as fields of R/T, but all the potential users are saying that they won't use R/T if they can't put arbitrary values in them. The reluctance of the authors is due to backward compatibility with sandboxed "secure" JavaScri…
I thought that the whole point is to have guaranteed deep immutability, which you can't have if it's got arbitrary objects in it.
Re: Proposal: JavaScript Structs
#199JS devs - do everything but write in another language challenge level: Impossible.
There's a lot of that, certainly, but there are legitimate reason to use JS/TS. Frontend is an obvious one but also using services like CF Workers or Deno Deploy which are optimized for V8. You're going to get better uptime and lower latency than anything else at that cost.
Re: Proposal: JavaScript Structs
#200I am not sure how to really refine this thought I have had, but I have this fear that every language eventually gets so bloated and complicated that it has a huge barrier to entry. The ones that stand out the most to me are C# and Typescript. Microsoft has a large team dedicated towards improving these languages constantly and instead of exclusively focusing on making them easier to use or more performant, they are c…
And here is the obligatory quote from Bjarne Stroustrup: "There are only two kinds of languages: the ones people complain about and the ones nobody uses."