BCS <n...@anon.com> wrote:

Hello Simen,

[...] suggest that
 typedef int foo;
 be kept as it is, and
 typedef int bar {
/* stuffs */
}
be sugar for
 struct bar {
int _payload;
alias _payload this;
/* stuffs */
}

One important aspect of what I proposed is that operators that aren't overridden still exist and use the same codegen as the base type (or are guarantied to generate the same machine code in all cases).



struct foo {
  float f;
  alias f this;
}

void main( ) {
  foo f;
  f = 3;
  f *= 4;
  f /= 8;
  f += 4/5;
  f -= sqrt( f );
}

This compiles and runs beautifully, so it seems alias this
does what you want.

--
Simen

Reply via email to