Adding a new design constraint to D

Max Samukha maxsamukha at gmail.com
Thu Jun 16 12:24:15 UTC 2022


On Thursday, 16 June 2022 at 11:10:33 UTC, Kagamin wrote:

>
> When you have a lazily initialized field, you need to use an 
> accessor, because if you read the raw field, you get an 
> uninitialized value and error as a result, so only the accessor 
> should have access to the field.

You can do that already for static/global functions by placing 
the cache in the function scope. In D, you can't access a 
function's scope at all, so it is true encapsulation.


More information about the Digitalmars-d mailing list