tail const

Fawzi Mohamed fawzi at gmx.ch
Sun Dec 5 01:06:57 PST 2010


On 5-dic-10, at 00:39, Fawzi Mohamed wrote:

> [...]
> Thus both have their function, but in general I think that tail  
> const might be even more important (if I had to choose one const/ 
> immutable type I would choose the tail one).

This was thought a bit as provocation, but as nobody reacted, and with  
trolls roving around I want to clarify.
the normal const obviously allows sharing, so it isn't a bad choice,  
but it introduces more constraints that needed to simply share memory.  
These constraints make the life more difficult, so I wondered if  
choosing tail const as only const would work.
It has issues, but not as bad as one would think, applying tail const  
to ref T is basically const on T. There are still issues but I thought  
lets throw that in and see what other think.

By the way I think that one of the problems in having const and tail  
const is that it is expressing the constness implied by one operator  
using the other operator, in this sense tail const might be (slightly)  
better

Fawzi


More information about the Digitalmars-d mailing list