std.experimental.logger formal review round 3

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 1 10:35:36 PDT 2014


There is still a critical issue with std.experimental.logger that 
would prevent it from being merged right now: The abuse of 
@trusted all over the code.

For example, the following piece of code compiles with 
burner/logger at c87e1032:
---
import std.experimental.logger.core;

struct Dangerous {
     string toString() {
         *(cast(int*)0xdeadbeef) = 0xcafebabe;
         return null;
     }
}

void main() @safe {
     logf("%s", Dangerous());
}
---

To be quite honest, I'm rather disappointed that I was able to 
break @safe-ty
with the first, most straightforward piece of code I tried. Sure, 
many people don't understand how dangerous @trusted applied to 
templates really is. But this issue has already been pointed out 
multiple times in Robert's code, both in this pull request and 
other unrelated ones.

David


More information about the Digitalmars-d mailing list