DMD Symbol Reference Analysis Pass
via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 27 02:56:48 PDT 2015
On Wednesday, 27 May 2015 at 08:43:07 UTC, Per Nordlöw wrote:
> On Wednesday, 27 May 2015 at 08:38:48 UTC, Per Nordlöw wrote:
>> AFAIK, in current DMD, I can't get any help in avoiding
>> patterns such as
>>
>> char[] saved_line;
>> foreach (line; File("foo.txt").byLine)
>> {
>> saved_line = line; // should give error
>> }
>
> If I understand you correctly, a new kind of qualifier for
> `line` may be motivated here. The semantic meaning of `scope` D
> is not related to volatile property. I guess the problem is
> somewhat related to reference counting and ownership, right.
See my other reply. Originally I thought so too, but it turns out
they can't really be separated. It's basically an instance of
Rust's restriction "exactly one mutable reference, or N immutable
references, but not both at the same time".
More information about the Digitalmars-d
mailing list