Why is D unpopular, redux.

Adam D Ruppe destructionator at gmail.com
Tue May 24 15:31:47 UTC 2022


On Tuesday, 24 May 2022 at 15:15:13 UTC, FeepingCreature wrote:
> Javascript, yes:

If you use `var`, the variable is hoisted to the top-level scope 
of the function, so this behavior is then expected.

Use the `let` keyword for a local lexically scope thing, and then 
you'll see the cb behavior is different.

Since D's scoping is more like `let` than `var`, JS is a point in 
favor of it being a bug.

(though JS's pattern to make it work anyway is what I also do in 
D today. It isn't that big of a deal.... though the fact the 
`immutable` is a lie there is what convinces me it is a bug 
anyway.)


More information about the Digitalmars-d mailing list