aliasing/referencing expressions in with statements

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 21 18:42:11 PDT 2016


On Thursday, 21 April 2016 at 23:05:38 UTC, deed wrote:
> Often I find myself wanting to alias an expression, such as 
> verbose fields, possibly nested. AFAIK, the with statement 
> makes it easier, but not as good as it could have been. What 
> I'd like to express is for example something like this:
>
> [...]

Maybe use something like:

auto a = () => instanceA.verboseFieldA.verboseFieldB;


More information about the Digitalmars-d-learn mailing list