Beta 2.094.0

DlangUser38 DlangUser at nowhere.ch
Sun Sep 13 20:52:11 UTC 2020


On Sunday, 13 September 2020 at 14:52:13 UTC, MrSmith wrote:
> On Friday, 11 September 2020 at 07:48:00 UTC, Martin Nowak 
> wrote:
>> Glad to announce the first beta for the 2.094.0 release, ♥ to 
>> the 49 contributors.
>>
>> This is the first release to be built with LDC on all 
>> platforms, so we'd welcome some more thorough beta testing.
>>
>> http://dlang.org/download.html#dmd_beta
>> http://dlang.org/changelog/2.094.0.html
>>
>> As usual please report any bugs at
>> https://issues.dlang.org
>>
>> -Martin
>
> One unfortunate sideeffect of allMembers change is that it 
> breaks this king of loop:
> ```
> foreach(m; __traits(allMembers, M)) { // M is module
>     alias member = __traits(getMember, M, m); // now fails 
> because std.stdio is not a member of M
> }
> ```
>
> To fix I needed to rewrite it as:
> ```
> foreach(m; __traits(allMembers, M)) { // M is module
>     static if (__traits(compiles, __traits(getMember, M, m)))
>         alias member = __traits(getMember, M, m);
> }
> ```

https://github.com/dlang/dmd/pull/11727

Note that previously you could do nothing with the partial alias, 
eg "std" instead of "std.stdio". Now that the fully qualified 
name is returned, and with the pending fixup
this works:

---
module m;

import std.stdio;

void main()
{
     alias s = __traits(getMember, m, "std.stdio");
     s.writeln("mmh");
     static assert(__traits(hasMember, m, "std.stdio"));
}
---

Anyway, thnaks for poiting out the problem. You were right, 
getMember had to work with anything that's returned by allMember. 
There nothing to discuss about that.


More information about the Digitalmars-d-announce mailing list