On Mon, 12 Jan 2015 23:06:16 +0000 jmh530 via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> I had seen some stuff on alias thing, but I hadn't bothered to > try to understand it until now. If I'm understanding the first > example <a href="http://dlang.org/class.html#AliasThis">here</a>, > alias this let's you refer to x in s by writing either s.x (as > normally) or just s. That didn't seem that interesting, but then > I found <a href="http://3d.benjamin-thaut.de/?p=90">example</a> > where they alias this'ed a struct method. That's pretty > interesting. there is nice page by p0nce and it shows nice and simple `alias this` trick usage: http://p0nce.github.io/d-idioms/#Extending-a-struct-with-alias-this and i have "stream.d" module in my IV package ( http://repo.or.cz/w/iv.d.git/tree ), which works with "i/o streams" by testing if passed struct/class has necessary methods (`isReadable!`, `isWriteable!`, `isSeekable!`, etc.
signature.asc
Description: PGP signature