Why is D unpopular, redux.

deadalnix deadalnix at gmail.com
Tue May 24 15:34:01 UTC 2022


On Tuesday, 24 May 2022 at 15:31:47 UTC, Adam D Ruppe wrote:
> 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.
>

While this is true, his example is even worse: the captured 
variable isn't declared **IN** the loop, so whether `var` or 
`let` is used changes nothing.


More information about the Digitalmars-d mailing list