with( a = instanceA.verboseFieldA.verboseFieldB, b = instanceA.aDescriptiveName, instanceC) { // use a, b and value: b[value] = b[a + value] * (a*value)^^a; } // given: struct A { B verboseFieldA; int[] aDescriptiveName; ... } struct B { int verboseFieldB; ... } struct C { int value; ... } A instanceA; B instanceB; C instanceC;1) Is it possible to achieve something similar in D now? And if not: 2) Are there any implementation considerations in this direction, extending the with statement?
aliasing/referencing expressions in with statements
deed via Digitalmars-d-learn Thu, 21 Apr 2016 16:11:29 -0700
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:
- aliasing/referencing expressions in wi... deed via Digitalmars-d-learn
- Re: aliasing/referencing expressi... Yuxuan Shui via Digitalmars-d-learn
- Re: aliasing/referencing expr... deed via Digitalmars-d-learn