Mike Chaten <mcha...@gmail.com> wrote:

I was under the impression that alias this just was shorthand for
Class Foo {
int x;
alias x this;
}
Foo foo =  new Foo
foo = 9; // foo.x = 9
Foo Foo = 9 // null.x =9;

Not just. this would also work:

int n = foo;
// void bar( int n ) {}
bar( foo );


Also, for opCast, doesnt that only work for going from Foo to int and not
the other way around?

Indeed. For implicit casts to Foo, I don't know what, if anything, works.

void baz( Foo f ) {}
baz( 3 ); // How?

Likely, there is no such functionality in D, at least for the moment.

--
Simen

Reply via email to