News for hackers. Stuff that matters.
Re:Firefox 74 by theandrewbailey on Tuesday March 10, 2020 @09:16AM (#22535146)
> Firefox has added support for the new JavaScript optional chaining operator (?.)

Cool! This sounds like something all programming languages should have had decades ago.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Re:Firefox 74 by jeffadotio on Tuesday March 10, 2020 @10:15AM (#22535594)
I like it, but idiomatic symbols are tough. When I look at some functional languages they seem so dense with operators that I have to use some inference (which I probably get at least partially wrong) to glean the meaning. This is a good operator that, in my opinion, should be in a dynamically-typed object-oriented language. But it is not as universally understood as most of JavaScript.

There is a place for languages that use more keywords and fewer operators as a design choice. Of course there also need to be languages that don’t have the undefined/null value and don’t need this.

Re:Firefox 74 by jmkni on Tuesday March 10, 2020 @09:40AM (#22535335)
This is only a recent addition to Typescript as well.

I'm working on a project built on Angular7 at the moment, and the version of Typescript we use is too old for this operator.

What happens when the browser supports an operator the version of Typescript you are using doesn't?

Re:Firefox 74 by untog on Tuesday March 10, 2020 @10:09AM (#22535551)
> What happens when the browser supports an operator the version of Typescript you are using doesn't?

Nothing, because the compiled TypeScript won't contain it. TypeScript is deliberately conservative about the language features it supports to ensure it never gets out of sync with JS.

Re:Firefox 74 by jve on Tuesday March 10, 2020 @09:43AM (#22535356)
> What happens when the browser supports an operator the version of Typescript you are using doesn't?

Well I'm certain that it won't compile. Your .ts file must go through tsc after all before you get .js