[Issue 15582] Slice returned by opSlice() not accepted as lvalue

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Jan 19 10:08:05 PST 2016


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

--- Comment #2 from Marc Schütz <schuetzm at gmx.net> ---
(In reply to b2.temp from comment #1)
> I don't aggree, it's like if you say that
> 
> s.opSlice() = 10;
> 
> should work.

That should work, too.

Note that appending another pair of brackets is already accepted. As long as
there's no ambiguity with assigning to the slice itself (i.e. the lhs is not an
lvalue, and opSlice doesn't return by ref), it should just do the appropriate
element-wise operation.

Analogously with *=, += etc.

--


More information about the Digitalmars-d-bugs mailing list