Can we fix this?

Imperatorn johan_forsberg_86 at hotmail.com
Thu Sep 30 17:29:09 UTC 2021


On Thursday, 30 September 2021 at 13:26:21 UTC, Tejas wrote:
> On Thursday, 30 September 2021 at 13:23:06 UTC, Imperatorn 
> wrote:
>> On Thursday, 30 September 2021 at 01:00:40 UTC, deadalnix 
>> wrote:
>>> [...]
>>
>> Maybe, idk.
>>
>> But I don't understand why we can't just do what (for example) 
>> C# does.
>>
>> No var in loop = closure captures the variable
>> var in loop = closure captures the value of the variable
>>
>> Sounds to me like a pretty "easy" thing to fix (if one could 
>> agree that such a solution would be acceptible)
>
> Because Walter thinks that duplicating behavior like C#'s and 
> other languages' will result in a huge performance hit, leading 
> users to get very frustrated.
>
> Here's the link : 
> https://forum.dlang.org/post/s83nb0$12rh$1@digitalmars.com

I understand the reasoning, but imo it's worth it to be able to 
write simpler code.

But on the other hand performance is ofc important. But on the 
third hand, if something is a hurdle for many to write correct 
code, it should be looked at again and re-evaluated.

Just my opinion


More information about the Digitalmars-d mailing list