Logical const

spir denis.spir at gmail.com
Wed Dec 1 03:13:08 PST 2010


On Tue, 30 Nov 2010 15:03:43 -0800
Walter Bright <newshound2 at digitalmars.com> wrote:

> Andrew Wiley wrote:
> > I've been following this thread on and off, but is there a definition 
> > somewhere of exactly what "const" means in D2 and exactly what that 
> > guaranties or doesn't guaranty? 
> 
> Const provides a read-only "view" of a reference and anything reachable through 
> that reference. It guarantees that no other thread can read or write that 
> reference or anything reachable through it.
> 
> It does not guarantee that there isn't a mutable alias to that reference 
> elsewhere in the same thread that may modify it.

What would be the consequences if D had no const, only immutable (that, IIUC, removes the latter non-guarantee)?


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list