ugly and/or useless features in the language.

z z at z.com
Sun May 23 14:47:15 UTC 2021


On Saturday, 15 May 2021 at 14:31:08 UTC, Alain De Vos wrote:
> Which parts in dlang don't you use and why ?
>
> Auto return types i find dangerous to use.

I found `auto` and `ref`(yes just `ref`) return types very useful 
for bypassing the type system, eg.:
```D
///function requires lvalue and the return value can be of any 
type while still being the same data.
ref mutateSomething(A)(ref A something) {
     static if (isArray!A){/*...*/} else {/*...*/}
     return something;
}
```

Other than that, i've found tuples limited in usage compared to 
just using a struct or static arrays.(the main problem is the 
inability to use runtime indexing even if the types match.)

The rest, i don't use from lack of interest or awareness it even 
exists.


More information about the Digitalmars-d-learn mailing list