January 10, 2022

Posted 2022-01-10

Core D Development Statistics

In the community

Community announcements

See more at the announce forum.

Tip of the Week

Any time you alias a member, the this pointer - a piece of runtime info - is discarded in favor of compile time info. Basically, alias treats EVERYTHING as if it was static, which is fine for reflection, but when using the member, you need to reattach this.

You can do that with __traits(child, the_alias, your_this). But often, instead of aliasing members, just make a little ref helper function:

alias b = rhs.num; // not much help

ref b() { return rhs.num; }
// now you can use b() as the shorthand version

I wrote a lil more about this here: https://forum.dlang.org/post/uxpocdcztllhwaxfwdac@forum.dlang.org