I wish all qualifiers were revisited with an eye for simplification

Steven Schveighoffer schveiguy at gmail.com
Mon Aug 24 16:27:10 UTC 2020

On 8/24/20 12:13 PM, Atila Neves wrote:
> On Sunday, 2 August 2020 at 20:50:14 UTC, Andrei Alexandrescu wrote:
>> (Background: qualifiers were introduced following my horror when I 
>> started writing D1 code and saw that strings are represented as 
>> char[]. So structs with string members would look like:
>> [...]
> Nearly every time I use inout I run into problems. Something doesn't 
> compile, I get annoyed, and switch to templated this.

I have the opposite experience -- inout just works most of the time.

> Can anyone tell me 
> what inout does that templated this doesn't?

1. It does not create a separate identical implementation for all 
flavors of mutability
2. It is not mutable even when the this reference is.

The problems with inout have nothing to do with its utility. They are 
artificial limitations that should not have been included.


More information about the Digitalmars-d mailing list