Some thoughts about C and D, return data through parameters

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 19 14:21:17 UTC 2017


On 12/19/17 6:27 AM, ketmar wrote:

> note that D devs stubbornly insists that `auto` is not a type 
> placeholder, but a storage qualifier, like `static`, so you can't write 
> `foreach (auto c; ...)` (and compiler rejects such code). yet, `if (auto 
> c = ...)` is perfectly allowed, and here `auto` is type placeholder. 
> talking about consistency, yeah.

I insist that auto is a storage qualifier, AND I think it should be 
allowed as the storage qualifier for the foreach variable.

foreach(ref c; ...) works. I don't see why foreach(auto c; ...) shouldn't.

-Steve


More information about the Digitalmars-d mailing list