mutable reference to const object

Steven Schveighoffer schveiguy at
Thu Oct 14 07:15:52 PDT 2010

On Tue, 12 Oct 2010 18:54:49 -0400, Jonathan M Davis <jmdavisProg at>  

> On Tuesday, October 12, 2010 15:27:41 Jesse Phillips wrote:
>> Jonathan M Davis Wrote:
>> > Unfortunately, at this point, tail const has pretty much been decided  
>> to
>> > be too difficult implement and/or too difficult to do cleanly, so it's
>> > not in D and likely never will be. If it's mentioned in the online  
>> docs,
>> > the docs need to be updated. It's been a long time since there was any
>> > kind of tail const in D.
>> >
>> > - Jonathan M Davis
>> What I have heard is that it can't be done syntactically for  
>> references. As
>> Denis shows you can do it with points (and arrays) but not object
>> references.
>> There are many syntax suggestion threads so I suggest search for them
>> before bring it up again.
> Yes, you can do it with pointers, but not with references, and it causes
> problems for stuff like ranges. There have been several discussions on  
> it over
> time, and Walter has pretty much said that it's not a feature that's  
> going to
> happen. He spent too much time on it before without success to want to  
> try at it
> again.

If someone were to do the work, and the syntax was bearable, it might be  
considered.  I think Walter no longer wants to accept any ideas without  
proof that they will work -- he's already worked enough on trying to  
implement tail-const.

I personally think tail const is going to be a very important feature that  
will not be solvable via the library.  Tail-const ranges are going to be  
very important when it comes to things like collections.


More information about the Digitalmars-d-learn mailing list