Often I'm using the following code pattern:

class S
{
   private SomeType cache;

   public SomeType SomeProp() @property
   {
      if (cache is null)
        cache = SomeExpensiveOperation();
      return cache;
   }
}

Is there any way to mark SomeProp() as const? Because I want to call somewhere const(S).SomeProp, which for the outside world is must be "const", returning just a value, even that internaly it modifies the internal S structure.

Reply via email to