Possible way to achieve lazy loading with const objects
Steven Schveighoffer
schveiguy at yahoo.com
Thu Sep 29 04:37:54 PDT 2011
On Wed, 28 Sep 2011 20:11:51 -0400, Peter Alexander
<peter.alexander.au at gmail.com> wrote:
> On 26/09/11 8:02 PM, Steven Schveighoffer wrote:
>> I think a better avenue would be to implement some sort of strong-pure
>> memoization system. Then all you have to do is make an immutable pure
>> member, and the compiler will take care of the rest for you.
>
> How can the compiler possibly figure out the best way to cache things
> for you?
>
> Or have I misunderstood?
It would likely be some sort of tag. Like:
@memoize pure int reallyTimeConsumingMethod() immutable
-Steve
More information about the Digitalmars-d
mailing list