Declare reference to variable ?

Dicebot public at dicebot.lv
Mon Jul 29 23:34:28 PDT 2013


On Monday, 29 July 2013 at 21:25:21 UTC, Temtaime wrote:
> No, i cannot.
>
> struct S {
> 	uint longnamed;
> }
>
> void main() {
> 	S somestruct;
>
> 	alias v = somestruct.longnamed;
> 	writeln(v);
> }
>
> Error: need 'this' for 'longnamed' of type 'uint'
>
> Is it a bug ?

I'd say this is something in between bug and enhancement request. 
Nothing explicitly states that alias should work this way but it 
matches concept of alias much better than current behavior.


More information about the Digitalmars-d-learn mailing list