write once type?

Jack jckj33 at gmail.com
Sun Apr 25 16:30:40 UTC 2021


On Tuesday, 20 April 2021 at 19:56:33 UTC, Steven Schveighoffer 
wrote:
> I have had the need in some cases to *maybe* set a const value 
> inside a loop. One can sometimes abstract this into a lambda 
> function, but sometimes this is not possible (e.g. if the loop 
> is static). Not only that, but I may also want to keep 
> processing the loop and do something different if the value has 
> already been set instead of returning immediately, which 
> necessitates a second loop.
>
> [...]

This is a feature that I wanted always since my C# and C++ time. 
I've tried to mimic it with class/struct (including readonly with 
C++) but it isn't same thing.


More information about the Digitalmars-d-learn mailing list