Javascript Madness... or: what ES2022 wants to enforce

Discussions about the development and maturation of the platform code (UXP).
Warning: may contain highly-technical topics.

Moderators: trava90, athenian200

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35402
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Javascript Madness... or: what ES2022 wants to enforce

Unread post by Moonchild » 2021-07-23, 09:02

So, I had a look at the up-and-coming changes currently being pushed by the (once again implementation-first Google driven) changes to JavaScript.

Apparently, ES2022 wants to add full-blown C++ class-type handling to JavaScript. This is total madness, trying to transform JS into some bastardized form of C++! I don't understand why this is even wanted, in the age of transpilers and WASM there's not even a need for someone who refuses to learn proper JS programming paradigms to not use C++ straight away anyway...

Just have a look at this kind of nonsense (of course already implemented in Chromium because... well you all know by now why):

Code: Select all

 // public instanced class fields
class C {
  x = 'x';
}
new C().x === 'x';

// Private instanced class fields and initializers
class C {
  #x;
  constructor(x){
    this.#x = x;
  }
  x(){
    return this.#x;
  }
}
new C(42).x() === 42;

class C {
  #x = 42;
  x(){
    return this.#x;
  }
}
new C().x() === 42;

// Private static methods
class C {
  static #x() { return 42; }
  x() {
    return C.#x();
  }
}
new C().x() === 42;
... and more.
I'm pretty much speechless at this point. If people want C++ SO BAD, make a new web scripting language like "Web-cpp" or something that does all that stuff and leave JavaScript alone.

I'd love to know what Brendan Eich would think about this.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2181
Joined: 2018-05-05, 13:29

Re: Javascript Madness... or: what ES2022 wants to enforce

Unread post by vannilla » 2021-07-23, 09:54

It's funny because C++ (and other languages like it) started implementing features made popular by languages like Javascript (even though those features are older then C++, but I digress) because developer actually asked for them, so I really fail to see why Javascript should be like Java when Java wants to be like Javascript.

shevy
Banned user
Banned user
Posts: 42
Joined: 2019-04-22, 01:05

Re: Javascript Madness... or: what ES2022 wants to enforce

Unread post by shevy » 2021-07-24, 14:54

I am very unhappy with JavaScript in general. Unfortunately I think there is not much that can be done - Google kind of controls
so much of the whole ecosystem. Even pointing this out on reddit leads to people being censored when they express being
dissatisfied with Google (although this may have more to do with how reddit moderators operate, admittedly ...).

Perhaps what could be done is for different people to come together and, even if they can not replace or change JavaScript,
to add JavaScript as if it were a "container". Like you have components that operate in "containers" and you can disable the
parts you never want to use or see being used on your computer.

That way people could easily disable parts they never want to see; I refer not only to vanilla JavaScript but also DOM and any
browser-specific parts. For instance, I always hated that external websites can force change onto my browsers such as disable
scrollbar, grey out the background and so forth. This is not directly related to the comment here about the copy/paste of C++
class-type handling to JavaScript as such, but it shows a general problem with the whole ecosystem - it's not really designed
well. It originated mostly from an ad-hoc basis and past that point kept on proliferating into very wild and strange ways.
Node/NPM is a wonderful example of how madness proliferates. Anyone remembers left-pad? I mean ... WHY does a language
need left-pad? A properly designed language already has support for padded-display built in from the get go ... so the
left-pad disaster originates LARGELY due to bad language design, and then AFTERWARDS people clowning up and just
using tons of add-ons without thinking about any problems that could arise from this ...

I suspect the people who retrofit a language are often e. g. heavy C++ users on their own, so their personal preferences
will leak out to others. I have seen this happen to "scripting" languages that suddenly add a type system. This happens in general
in the past, to many other languages, how they are suddenly changed; it's not necessarily unique to JavaScript. Just look at
how many languages copy/paste the C style. One of the few languages that didn't do this was Go (but Go has other problems
in particular being controlled by Google).

New Tobin Paradigm

Re: Javascript Madness... or: what ES2022 wants to enforce

Unread post by New Tobin Paradigm » 2021-07-24, 14:59

shevy wrote:
2021-07-24, 14:54
I am very unhappy with JavaScript in general. Unfortunately I think there is not much that can be done - Google kind of controls
so much of the whole ecosystem. Even pointing this out on reddit leads to people being censored when they express being
dissatisfied with Google (although this may have more to do with how reddit moderators operate, admittedly ...).
See: viewtopic.php?f=62&t=27175

Locked