On Friday, 13 November 2015 at 00:58:57 UTC, Walter Bright wrote:
On 11/12/2015 2:58 PM, deadalnix wrote:
You can have a template that
do mixin without creating loop because then you pass it down identifiers that
won't resolve.

My brain seg faulted trying to parse that.

module a;

struct S(E) {
    import std.bitfield;
    mixin(bitfield!(
        bool, "flag", 1,
        T, "myT", SizeOf!T,
        uint, "", 32 - SizeOf!T - 1,
    ));
}

module b;

enum MyEnum { Val1, Val2, Val3 }

import a;
alias UsefulStruct = S!MyEnum; // Boom, MyEnum is undefined

Now you end up having to tie stupid node into your code, like adding all user of library X as import in library X. Which sucks, but is forced by the language design.

Reply via email to