D Beginner Trying Manual Memory Management

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 13 00:30:14 PST 2015


On Mon, 12 Jan 2015 23:06:16 +0000
jmh530 via Digitalmars-d-learn <digitalmars-d-learn at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150113/bb230629/attachment.sig>


More information about the Digitalmars-d-learn mailing list