On 05/21/2018 01:30 PM, Paul Backus wrote:

I'm not sure making `_data` private is really a good idea. For example, this only works if `_data` is public:

import std.algorithm;
import std.range;
import std.stdio;

struct MyType
{
     auto _data = iota(10);
     alias _data this;
}

void main()
{
     MyType x;
     x.each!writeln;
}

Ouch, and the error message isn't very helpful either. I wonder what causes this to fail though, and whether it might simply be a compiler bug?

Reply via email to