DIP 50 - AST macros

dennis luehring dl.soluz at gmx.net
Mon Nov 11 05:22:33 PST 2013


Am 11.11.2013 13:36, schrieb Rikki Cattermole:
> On Monday, 11 November 2013 at 12:30:07 UTC, Jacob Carlborg wrote:
>> Yes, I still don't understand why you would want it as a
>> pragma. Be usable outside of macros?
>
> Yes outside of macros would be useful. For example code like this
> would become redundant:
> pragma(msg, "Support for x is not implemented on platform y");
> static assert(0);
>
> Becoming:
> pragma(error, "Support for x is not implemented on platform y");
>
> Also pragma's core responsibility is to cause the compiler to do
> something. In this case to say we hit an error during compilation
> please tell the user/dev and die.
>
> It is a hook to the compilers workings.
>
> Currently working on getting this implemented. Nearly done with
> it. Just got some extra spaces that shouldn't be in output.

but in macros the context information is much more interesting then 
anything else - so #pragma(error,...) won't fully fit the needs to 
context error returning - it could be much more then just a message

example: to help the compiler forming better error messages - or maybe 
recover from deep macro expansion etc...)

what you want is just #pragma(error,...) -> break compiliation now
Jacob is talking about the feedback for the compiler thing...




More information about the Digitalmars-d mailing list