const

Russell Lewis webmaster at villagersonline.com
Fri Mar 28 10:44:21 PDT 2008


Lars Ivar Igesund wrote:
> You completely disregard the _real_ reason for people being hostile against the new const regime, in fact I think you are arrogant to the extreme; people are negative to the current regime because it is not good enough. You haven't burned a single ounce of goodwill with your various attempts - you have only showed that you are willing to let the community test the concepts. But now you have decided that you have found the "perfect", or at least best possible, solution - and while everyone agree that it is better than previous attempts, it is still not good enough for wide usage, or even medium usage. What the community need is a commitment to make the const system work, even if it requires even more changes - that is what a unstable compiler is for. 
> 
> If the const regime had been ready, you would most likely have seen a fairly massive surge of new users for D 2.0 - heck, we could even consider start porting Tango properly then. As it is now, I just have this icky feeling, going around hoping you will come around and make it work.

The post above states is a bit more strongly than I would prefer, but it 
somewhat reflects my view of the current state of const.

To put things more gently, I think that what we have right now is an 
empirical (that is, experiment- and experience-based) understanding of 
const.  The current const design seems to work pretty well with the 
cases that we've considered so far.  But that was also true of C++'s 
const when it was designed, and to put it bluntly, it was true with the 
previous iterations of const in D.  The previous iterations of const in 
D were shot down quickly on the NG because people posted (within a week 
or two) clear examples of glaring weaknesses in them.

With our current const regime, the best we can say is, "we have not yet 
seen any clear examples of glaring weaknesses."  Or, to be more honest, 
"the weaknesses which have been posted so far are things we are willing 
to live with."  I don't have a lot of confidence that 10 years from now, 
or even 10 months from now, we won't be tearing const apart and 
rebuilding it, AGAIN.

We're going to face this problem over and over, IMHO, until somebody can 
build up const from abstract first principles.  Who are the users of 
const?  (Library writers, ordinary coders, optimizers, etc.)  What are 
the threats to const?  (Synchronous function calls, asynchronous 
function calls (signal handlers and interrupts), multithreading, 
external devices (DMA), etc.?)  What are the things that somebody might 
want to express (you can't modify, nobody will ever modify, nobody will 
modify in this window of time, logical const, copy-on-write semantics, 
somebody asynchronously *will* modify in this window, etc.)

Until we have this fundamental, mathematical understanding of const, we 
are just tweaking and hacking and patching in hopes we can come up with 
something good enough.



More information about the Digitalmars-d mailing list