Making RCSlice and DIP74 work with const and immutable

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Sun Mar 1 07:40:04 PST 2015


On Sunday, 1 March 2015 at 02:53:34 UTC, Manu wrote:
> On 1 March 2015 at 12:48, Andrei Alexandrescu via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> On 2/28/15 6:33 PM, Manu via Digitalmars-d wrote:
>>>
>>> one of the biggest recurring
>>> complaints relating to the D type system
>>
>>
>> That didn't get talked about in I don't remember. -- Andrei
>
> So, what's the solution?
> I've never complained about it, but I still have this problem
> regularly. The solution in my experience is; 'everything is 
> always
> mutable'.

I've lost count now of how many times I've had to downgrade to 
auto despite always wanting immutable or const. This doesn't work:

  auto reg = regex(`(foo)`);
  const match = "foo".matchAll(reg);
  writeln(match.captures); //oops, captures isn't const

It should, but it doesn't. Maxime talked about it here as well:

http://pointersgonewild.com/2014/07/11/the-constness-problem/

Atila


More information about the Digitalmars-d mailing list