Memoize and protected functions

David Nadlinger see at klickverbot.at
Sat May 12 04:44:58 PDT 2012


On Saturday, 12 May 2012 at 11:33:10 UTC, David Nadlinger wrote:
> In my opinion, this is a … uhm … _questionable_ design 
> decision, […]

If it wasn't clear from the context: I'd propose to instead check 
protection for aliases exactly once at the place where it is 
»created«. In my opinion, this is clearly the behavior that one 
would intuitively expect, just like for (e.g. function) pointers, 
where it doesn't matter if the type system would allow you to 
access the entity directly once somebody who is allowed to passed 
you a reference.

The only possible complication I can see right now caused by this 
is with (rarely used) synchronized classes, where a closer look 
might be necessary regarding aliases to private functions (which 
are not automatically protected by the class mutex).

David


More information about the Digitalmars-d mailing list