On Thursday, 28 April 2016 at 11:10:21 UTC, Artur Skawina wrote:
On 04/28/16 10:28, Adrian Matoga via Digitalmars-d wrote:
On Wednesday, 27 April 2016 at 18:34:18 UTC, Artur Skawina
wrote:
[...]
ref Ex1() { return e1.someProperties.someModulusX; }
Unless any of the properties is an enum or, well, a @property,
and I'd expect both in such case.
s/ref/@property auto ref/, but it either won't matter in
practice (@property) or be easily fixable (non-lvals).
The main point was that what OP is asking for is yet another
function definition syntax. D has quite a few already, and
more are regularly requested (like overloading `alias`).
Adding a special case just for with-expressions wouldn't
be a good idea.
artur
If it's just about syntax sugar, I definitely would prefer to be
able to use alias over ref, e.g.
alias v = el.someProperties.aRatio;