Head Const

ZombineDev via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 15 15:39:56 PST 2016


On Monday, 15 February 2016 at 23:28:28 UTC, Walter Bright wrote:
> On 2/15/2016 3:11 PM, ZombineDev wrote:
>> I'll leave to others to discuss whether a language solution is 
>> worth it, but I
>> just wanted to point out there are two library solutions in 
>> this area:
>> HeadConst [1] - PR pending, and
>> Rebindable (tail const) [2] - already part of Phobos.
>>
>> Maybe if the language could express head const, it also makes 
>> sense to have tail
>> const.
>>
>> [1]: https://github.com/D-Programming-Language/phobos/pull/3862
>> [2]: 
>> http://dlang.org/phobos-prerelease/std_typecons.html#.Rebindable
>
> Transitive const is tail const.

I used the term "tail const" as a mutable pointer/reference to 
const/immutable object, where transitivity starts from the object 
(not from the pointer, which is what currently happens if you 
type `const Object o`).



More information about the Digitalmars-d mailing list