On Thursday, August 09, 2012 18:46:59 David Nadlinger wrote: > On Thursday, 9 August 2012 at 16:37:57 UTC, Dmitry Olshansky > > wrote: > > Too fast.. should have been: > > ubyte[16] getDidgest(); > > alias getDigest this; > > I have been thinking about using AliasThis as well, but the > problem is that precisely the use case this is meant to enable > (i.e. »snapping together components«, like Walter said) tends > to get broken in subtle ways due to the use of template > functions/type inference.
Yeah. alias this can be very useful, but it's very dangerous when it comes to templated functions, because it's very easy to make assumptions when writing those functions which hold great when using the actual type but do funny things when alias this comes into play. And unfortunately, I don't think that it's something that's at all well understood. It's probably one of those things that we as a community need to get a better grip on. Just imagine how bad it would be though if D allowed as many implicit conversions as C++ does... - Jonathan M Davis