[Issue 15651] filter: only parameters or stack based variables can be inout

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 24 10:03:03 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=15651

--- Comment #5 from Harry Vennik <htvennik at gmail.com> ---
(In reply to Steven Schveighoffer from comment #3)
> I'd try my hand at an inout improvement DIP, but I feel it would likely be
> rejected on principle, since inout is so disfavored by leadership.

I already have a partial draft. But as the discussion on various inout related
issues evolved, I stopped writing for the moment, as there seem to be quite
different opinions. My intent was to keep inout semantics the same as much as
possible. The main proposal in my draft is to allow a function that somehow has
acces to an inout variable from an enclosing scope to return inout.

This requires some additional scoping rules for delegates to prevent escaping
references to inout variables. In theory DIP25 already gets close, though its
implementation currently does not seem to detect return ref violations that
involve delegates.

About inout fields in structs: I think those could be allowed inside inout
functions, but such struct should not be allowed to escape from the scope of
that function.

--


More information about the Digitalmars-d-bugs mailing list