On Mon, 14 May 2012 15:05:01 -0400, Alex Rønne Petersen
<[email protected]> wrote:
On 14-05-2012 21:04, Mehrdad wrote:
On Monday, 14 May 2012 at 18:52:06 UTC, deadalnix wrote:
The only reason I'd see a toSting function as non pure or non const is
memoize. It can be tackled with lib support in phobos.
What are other uses cases ?
Not necessarily 'memoization' -- you could be instead querying
another object for this information, which may not be const.
(Say, a network connection.)
That's actually a very, very good point.
Yes, the use case for logical const is when an object *doesn't own* a
reference. I proposed a logical const solution a long time ago that
called it "nostate" instad of "mutable".
But there is a really big problem with logical const that makes it not
seem worth the trouble of having it -- the syntax. You would need a lot
of keywords and/or features to correctly describe relationships between
objects. I just don't think people would tolerate it.
Hm... I just had a really good idea (I will divulge it in another post) on
how to implement logical const without altering the language and/or
compiler.
-Steve