It feels disingenous to want to call a caching object even
"logically" const. There has to be a scaffolding-based but
hopefully generic compromise. I haven't yet tested this belief,
but I believe "physical" const is of good use wherever it can be
applied.
On Friday, 21 June 2019 at 23:39:20 UTC, H. S. Teoh wrote:
The problem with this is that you cannot use const(Wrapper).
In particular, if you have a function that wants to document
that it does not mutate its argument, you cannot write:
auto func(in Wrapper data) { ... }
because const(Wrapper) does not allow lazy initialization.
...
IMHO, in parameters are a more important scenario than const in
ranges (of course, same constraints).
Just for the heck of it, I'll try to get a snippet "working" but
I see out parameters snaking all through the call chain!