1. 14
  1. 5

    This isn’t so much a post about Firefox 90, as it is a post about some changes to the version of JavaScript that Firefox 90 executes. The changes are:

    • Support for private class fields.
    • Addition of .at() method for arrays, which supports negative indexing to “index from the end”, similar to Python (so -1 is the last item in the array).
    • Addition of a “conic gradient” coloring option in Canvas 2D.
    • New headers related to the HTTP fetch API.
    1. 8

      Private class fields, oh boy.

      The enterprise programmers are not finished colonizing that poor wayward lisp yet. :(

      1. 3

        It’s kinda funny that they picked Perl/Ruby-esque sigil syntax for private fields inside basically-Java class syntax. Interesting mix.

        1. 2

          at()? Why not just use the normal indexing with brackets?

          1. 3

            Probably because negative indexes are already a thing. Semantically, arrays are just hash maps with a few utility methods. arr[10] = “hello” sets the string key ”hello”, and for (let i in arr) iterates over array keys as strings. arr[-10] already refers to the hash map element with key ”-10”.

            Actually, originally, JavaScript didn’t even have an array type. Instead, objects with numeric string keys were used. That’s why the magical arguments variable is an “array-like object” instead of an array. Eventually, an actual array type was added, but as described above, it’s still just a hash map.

            Yeah, JavaScript is a horrible language.

            1. 3

              I wish they would just fix the language instead of making these changes in a backwards-compatible way, and it doesn’t even need to be a breaking change if you add 'use strict 2021'; or something.

              Now every JavaScript developer will need to remember two ways to access arrays, which are only subtly different, just in the off chance that someone used this weird bug/feature.

              1. 1

                Then they’ll have to admit the language is crazy and only exists because of coincidences.

                After all the harsh words against less cool languages over the year that is too hard even after TypeScript have proven beyond all reasonable doubt that a typed JS-like language is not only technically possible but a massive productivity boost.

                Now, don’t get me wrong: The JS community is cool and produces awesome software despite having to deal with a terrible no good language. In fact it makes it even more impressive.

                But it is still like doing amazing artistry on a one-wheel-bike, propped up with gyro stabilizers like linters etc.

                Amazing, but should have been totally unnecessary when ordinary bikes (e.g. Java) were already on the market.