Live data from Hacker News

New WebKit Features in Safari 13.1

webkit.org

11–20 of 60 posts

Re: New WebKit Features in Safari 13.1

#11
post #7
post #5

On a side note, I find crazy this obsessive-compulsive behavior to use `const` everywhere in modern JS codebase (even in Webkit now). It solves really no problem (I mean, Python, Ruby and almost all other programming languages are doing fine without preventing against variable reassignment, and we can still reassign function parameters and object properties in JS). So much brain power wasted on this useless thing. Al…

Immutability has been pretty hot of late, though still controversial. There are several popular languages which encourage or even force immutability (Elixir, Clojure). What sold me on the idea was Rich Hickey's talk, "The Value of Values": https://www.youtube.com/watch?v=-6BsiVyC1kM I look at it as mostly a safety net: I'd rather use const by default, unless I have a good reason to be able to mutate the variable. (To…

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer).

const arr = ['foo'];

arr[0] = 'bar';

assert(arr[0] === 'bar'); // !!!

Something like that would make sense though IMHO:

const PHI = 1.618;

I don't get how JS is designed really, they try to solve a bad design (`var`) but they introduce another bad design (`const`) and they make things even messier. Many devs ship JavaScript thought TypeScript these days, so I hope Microsoft can clean this mess one day.

Re: New WebKit Features in Safari 13.1

#12
post #9

> These improvements are available to users running watchOS 6.2 [...] I would like more information about Safari being available on Apple Watch. Normally I'd think it's inclusion was an accident or oversight, but it's mentioned at both the top and the bottom of the article.

Not a standalone browser app, but if I tap a link in say the watchOS Mail app, it'll display a web view. Developers can optimize their site for the watch display. It might sound crazy but it's useful for glancing at brief information on the web.

Re: New WebKit Features in Safari 13.1

#13
post #11
post #7

Earlier quoted context omitted.

Immutability has been pretty hot of late, though still controversial. There are several popular languages which encourage or even force immutability (Elixir, Clojure). What sold me on the idea was Rich Hickey's talk, "The Value of Values": https://www.youtube.com/watch?v=-6BsiVyC1kM I look at it as mostly a safety net: I'd rather use const by default, unless I have a good reason to be able to mutate the variable. (To…

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer). const arr = ['foo']; arr[0] = 'bar'; assert(arr[0] === 'bar'); // !!! Something like that would make sense though IMHO: const PHI = 1.618; I don't get how JS is designed really, they try to solve a bad design (`var`)…

What about const/let is poorly designed?

Re: New WebKit Features in Safari 13.1

#14
post #11
post #7

Earlier quoted context omitted.

Immutability has been pretty hot of late, though still controversial. There are several popular languages which encourage or even force immutability (Elixir, Clojure). What sold me on the idea was Rich Hickey's talk, "The Value of Values": https://www.youtube.com/watch?v=-6BsiVyC1kM I look at it as mostly a safety net: I'd rather use const by default, unless I have a good reason to be able to mutate the variable. (To…

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer). const arr = ['foo']; arr[0] = 'bar'; assert(arr[0] === 'bar'); // !!! Something like that would make sense though IMHO: const PHI = 1.618; I don't get how JS is designed really, they try to solve a bad design (`var`)…

The issue I have with `const` is not your original premise, but the one you allude to here: people confuse reassignment and immutability. Because of this, they end up using const/let to "signify that they're not changing a variable," when it doesn't actually matter anyway, because they're thinking of immutability but disambiguating reassignment capability. You can usually tell who has only a superficial understanding of the language by reading how `const` and `let` are used in their code.

Personally, I default to const, and use it pretty much 99.9% of the time. I use `let` in the few cases where it's actually useful to have a block-scoped variable. Ironically, this probably does a better job of "communicating" intent than the ritualistic obsession with "immutability" does, simply because you know if you're deviating from the default, there is a good reason for it.

Re: New WebKit Features in Safari 13.1

#15
post #5

On a side note, I find crazy this obsessive-compulsive behavior to use `const` everywhere in modern JS codebase (even in Webkit now). It solves really no problem (I mean, Python, Ruby and almost all other programming languages are doing fine without preventing against variable reassignment, and we can still reassign function parameters and object properties in JS). So much brain power wasted on this useless thing. Al…

There are very few places where you ever need to use let or var. const is solving important issues

  - it has lexical scope instead var function scope
  - it does not hoist like var
  - it prevents accidental reassignment
Accidental reassignment happen more often in JS because of non-lexial scoping, weakly typed and async functions. Also, both Ruby and Python are "strongly typed" as opposed to weakly typed Javascript.

Re: New WebKit Features in Safari 13.1

#16
post #11

Earlier quoted context omitted.

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer). const arr = ['foo']; arr[0] = 'bar'; assert(arr[0] === 'bar'); // !!! Something like that would make sense though IMHO: const PHI = 1.618; I don't get how JS is designed really, they try to solve a bad design (`var`)…

What about const/let is poorly designed?

Have a look here:

https://jamie.build/const

https://twitter.com/dan_abramov/status/1208369896880558080 (React core team member)

https://twitter.com/littlecalculist/status/91787524189167616... (Ember creator)

Re: New WebKit Features in Safari 13.1

#17
post #10

At least I think WebRTC was mentioned, been dying for more fixes to issues.

Apple has intentionally crippled WebRTC for years to stifle FaceTime competition and drive up dev costs by forcing native app development. The video chat startup I co-founded in 2015 was impacted. https://docs.house.gov/meetings/JU/JU05/20190716/109793/HHRG...

Hi maxwell, what would you recommend to another developer who might be entering the same space with a WebRTC-based product?

Re: New WebKit Features in Safari 13.1

#18
post #11
post #7

Earlier quoted context omitted.

Immutability has been pretty hot of late, though still controversial. There are several popular languages which encourage or even force immutability (Elixir, Clojure). What sold me on the idea was Rich Hickey's talk, "The Value of Values": https://www.youtube.com/watch?v=-6BsiVyC1kM I look at it as mostly a safety net: I'd rather use const by default, unless I have a good reason to be able to mutate the variable. (To…

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer). const arr = ['foo']; arr[0] = 'bar'; assert(arr[0] === 'bar'); // !!! Something like that would make sense though IMHO: const PHI = 1.618; I don't get how JS is designed really, they try to solve a bad design (`var`)…

Yeah, that's fair, I've been bitten by "not actually immutable" bugs before (works well enough for primitives, but not objects or arrays, which is most things in JS-land!). Libraries like Immutable.js can help bridge the gap.

> they try to solve a bad design (`var`) but they introduce another bad design (`const`)

`let` is intended to be the actual `var` replacement, and it's okay for that. I think there's an argument that `const` is a bad design, in the sense that it's deceptive, under the not-that-uncommon case you describe. Still, I'd rather have it than not, and I personally still like defaulting to `const` and opting-in to `let` in the (rarer and rarer) event that it's needed. (I'm also on 100% TypeScript at this point, which doesn't remove the potential for problems, but does provide an extra layer of guard rails in general.)

Re: New WebKit Features in Safari 13.1

#19
post #18
post #11

Earlier quoted context omitted.

I agree lukifer. Immutability is useful and interesting, but `const` in JS not really about immutability, it's about variable reassignment (which is trivial to handle really, even for a noob programmer). const arr = ['foo']; arr[0] = 'bar'; assert(arr[0] === 'bar'); // !!! Something like that would make sense though IMHO: const PHI = 1.618; I don't get how JS is designed really, they try to solve a bad design (`var`)…

Yeah, that's fair, I've been bitten by "not actually immutable" bugs before (works well enough for primitives, but not objects or arrays, which is most things in JS-land!). Libraries like Immutable.js can help bridge the gap. > they try to solve a bad design (`var`) but they introduce another bad design (`const`) `let` is intended to be the actual `var` replacement, and it's okay for that. I think there's an argument…

Yes, `let` is fine. I use `let` 99% of the time in my personal projects, it's more convenient, but I often must use `const` when working on an existing codebase. :(

Most of JavaScript devs do like you, they default to `const` and if they need to reassign the variable, they switch to `let`.

To me it feels more like a ceremony for declaring a variable than a rational and a useful practice. :)

Re: New WebKit Features in Safari 13.1

#20
I do love browse with Safari from time to time, but it would not take long for me to notice a site's behaviour being "different" because of it. Use hn.algolia.com as an example, on Safari 13.1, the site currently renders differently to Chrome (black background?) and the time range filter (Past Year/Month etc) text are missing...
Post reply on HN