My Kingdom For ...
Christopher Wright
dhasenan at gmail.com
Thu Feb 21 19:20:27 PST 2008
Bill Baxter wrote:
> On the other hand, the "return a reference" solution also has drawbacks
> in that it exposes the implementation and gives up control over the
> element. Consider for instance an array wrapper where you want to track
> every modification to every element. Currently you can do that quite
> easily by making opIndexAssign the only means of modifying the data. But
> then you can't do things like a[10] += 5. So I think there's a place
> for the solution you use in MiniD as well. Even after reference returns
> become possible I'd be happy to see the compiler use that trick in cases
> where there is no reference-returning version of opIndex defined.
>
> --bb
C# does exactly the same as MiniD. I don't recall how that works with
opDot on structs, though.
More information about the Digitalmars-d
mailing list