traits getProtection

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Apr 3 08:35:47 PDT 2012


On 4/3/12, Adam D. Ruppe <destructionator at gmail.com> wrote:
> is kinda fragile in general since it will swallow unrelated
> errors too.

That's an issue I've noticed recently. msgpack-d allows me to define a
custom serialization routine in my structs/classes, but it has to be a
template. Then msgpack tries to instantiate it via __traits(compiles),
and if it doesn't work it just skips calling the routine alltogether.
So if I have invalid code in my template I'll never know because the
external library just swallows the errors.

It took me a long time to figure out why my routine wasn't called. I
really wish DMD would semantically check templates at least partially
even if they're never instantiated.


More information about the Digitalmars-d mailing list