Logical const

Peter Alexander peter.alexander.au at gmail.com
Sun Nov 28 12:16:51 PST 2010


On 28/11/10 7:33 PM, Andrei Alexandrescu wrote:
> Mutable is a disaster with read-write locks. Without mutable, you could
> surround a C++ object with a read-write lock and count on const member
> functions being lockable with read locks. With mutable, all that
> guarantee is out the window.

I agree with this, but it could work with an extra storage class.

It's clear to me that logical const and binary const are two separate, 
but useful concepts. In my opinion, choosing one in exclusion of the 
other (as C++ and D have done) is not a sensible way to approach the issue.


> This is probably not going to get a lot of community traction :o).

Yeah, but I figured it would be a good idea to at least propose a 
solution rather than just say "this sucks!" without any suggestion of a 
better way of doing things.


> I think you are able to implement memoization in a library. At any rate,
> I think "X is unusable because I can't use it with obscure idiom Y" is a
> dangerous state of mind. Of course memoization is more or less obscure
> depending on whom you ask, but objective speaking it's simply not that
> frequent, and definitely not something you can't achieve in a variety of
> ways.

I work as a game developer, so performance means a lot to me, and 
(unfortunately for me it seems) memoization is not all that obscure in 
the kinds of programs I write :-(


More information about the Digitalmars-d mailing list