On Mon, 25 May 2015 09:24:56 +0000, ZombineDev wrote:

> alias can't refer to a nested member:
> -------------
> struct Point2 {
>      float x;
>      float y;
> }
> 
> struct Line2 {
>      Point2 start;
>      Point2 end;
> 
>      mixin Access;
> 
>      // alias x1 = this.start.x; <- this doesn't work :(
> 
>      alias x1 = get!"start.x";
>      alias y1 = get!"start.y";
>      alias x2 = get!"end.x";
>      alias y2 = get!"end.y";
> }
> 
> // I need to use a mixin to flatten the access :(
> private mixin template Access()
> {
>      ref auto get(string accessPattern)() inout {
>          return mixin(accessPattern);
>      }
> }
> -------------

i wonder if there is a reason for that limitation (except "nobody 
implemented that feature yet", of course).

Attachment: signature.asc
Description: PGP signature

Reply via email to