I very much like knowing where a local variable stops being relevant. Often I'll do things like
let foo;
const bar = f();
const baz = g();
foo = h(bar, baz);
to contain intermediate variables in a lexical scope (TypeScript is trashy that I have to define `foo` outside the braces—Julia etc. blocks can return).

I wish syntax or editors helped even more in showing when a variable stops mattering. It might be one of those small ergonomic things that add up to much more.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!