Hacker News new | ask | show | jobs
by masklinn 3203 days ago
> There aren't frequent cases […] Since they do get switched so often

They don't. In fact they almost never do.

> tl;dr Block scoping and constants are the exception

That's literally the opposite of reality. Constant bindings (single-assignment) and block-scoped bindings are by far the most common state of affairs even if not formally stated.

> What I meant here is that people shouldn't keep using var just so they can continue writing bad code.

Maybe you should tell the you of two comments ago who's apparently arguing for exactly that?

1 comments

What's with the hostility? I'm just trying to express my opinion. You can disagree and state your point without being insulting.

Sure, when I say frequent, I don't mean its happening all the time all over the place, I just means it can and does happen without consequence. Block scoping and constants, in the sense that it's important that they're block scoped and constant, are the exception. Most variables are single-assignment not out of necessity. And I bet most people think in function scope, regardless of how the compiler works.

It all still comes down to intent. If you're always defaulting to using const, your intention is not really showing through.

As an outside observer I have to say that they are not the one who came off as hostile.