7
respex
3y

Greetings, fellow JS devs
What change do you want on the next breaking version of JS?
I would say use square bracket instead of curly bracket for object.
What do you think?

Comments
  • 7
    Please don't.
    That's just going to mess with every multilingual dev out there.

    [] = array / list
    {} = object

    Simples.
  • 13
    It would b marvelous to fuck up the most fucked up language even more.
  • 7
    Yeah let's call it PHP too.
    What's wrong with you?
  • 1
    @C0D4 wait a sec, neither golang nor c/c++ init arrays with square brackets, if I'm not mistaken?
  • 1
    log to alert
  • 5
    @nitwhiz c++ and goLang initialize with [] but fill with {} 😑
  • 3
    Tail calls
    Operator overloading by whatever means possible (could also be a babel+typescript feature)
    Runtime AST reflection to support expressions as first-class values (again, could probably be a babel feature)
    A sensible API in place of the current (unsubscribing from events is done in the worst way possible) (could be a definitive package but it needs to be proper standard then)
  • 2
    Add even more fucked up castings please.
  • 13
    Replace semicolon with 🤡 and make it mandatory
  • 1
    @lbfalvy Now we're talking seriously, allow skipping the "this." inside class methods.
  • 1
    @IntrusionCM hehe was thinking something along those lines, I still love JS tho
  • 1
    @C0D4 Which one is more consistent?

    This

    [] = array / list

    {} = object

    {} = code block

    Or this

    [] = array / list

    [] = object

    {} = code block
  • 3
    @respex don't come at me with consistency with a language that doesn't know the meaning of the word 😂

    Tell me what this is.

    let x = []

    Is it an array? Is it an object?
    You'll never know if both instantiations are the same.
  • 1
    @respex

    An object is usually just a wrapped code block - it has it's own scope… hence the {} makes sense.
  • 1
    @aaronswartz ... Which transpiles to JS.
  • 1
    @aaronswartz TS is annotated JS, see my complaints.
  • 4
    the change i want for JS is to be replaced with WASM. finally. completely. irrevokably.
  • 0
    @tosensei WASM does not replace JS, you just don't code using the language. The binary is the same as if you had written using the language (of course, with more safety and no useless casts, etc).

    The binary is ready to execute, and that's a plus.

    But the underlying engine still JS.
  • 1
    @c3r38r170 you could use the keyword with. But I don't know why everyone screams that that's a bad practice.
  • 2
    @ChristoPy at the point where javascript is abstracted so far away you _don't_ have any contact with it, it _functionally_ doesn't exist anymore. and therefore, for all intents and purposes, has been replaced.

    that being said: "the underlying engine [is] still JS"? you got any source for that? because it seems extremely counter-intuitive to me to design a _near native_, low-level bytecode-format, just to run it via a high-level, badly-designed interpreted language.
  • 0
    @tosensei I'm talking about how the language *works* internally, on the VM side. Not the code itself.

    I'm talking about the machine code generated after a JS file is downloaded, parsed and then compiled to machine code.

    The WASM machine code is different from the machine code generated from a JS code. For performance purposes.

    Even tough, different, the internal APIs are the same. Both byte codes work together.

    And, for sources:

    " the virtual machine that we talked about earlier will now load and run two types of code" from: https://developer.mozilla.org/en-US...

    "Since JavaScript has complete control over how WebAssembly code is downloaded, compiled and run, JavaScript developers could even think of WebAssembly as just a JavaScript feature for efficiently generating high-performance functions." from: https://developer.mozilla.org/en-US...
  • 2
    @ChristoPy so in short: the _language_ of javascript, which is the awful, headache-inducing, stockholm-syndrome-causing part of the whole setup, can be replaced.
  • 3
    @ChristoPy That's like saying that C and Haskell are basically the same language because the executed code is the same.
  • 0
    @tosensei yeah, it can be
  • 0
    @lbfalvy if they run on the same VM, yes, probably
  • 2
    @ChristoPy They are both compiled so they both run on the same physical machine and utilize the same instruction set.
  • 2
    @lbfalvy ok, you got me now! Haha
  • 2
    This is genius! Changing the semantics of existing brackets would be an absolute troll move! It would strengthen JS’s reputation as the #1 clown language for sure!
  • 1
    @ChristoPy Yes, better, but still redundant.
  • 0
    @C0D4 It's indexed data

    arrayName[index: number]

    objectName[index: string]
Add Comment