DIP 1003: remove `body` as a keyword

WM.H via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Nov 24 07:29:41 PST 2016


On Saturday, 19 November 2016 at 21:16:15 UTC, Dicebot wrote:
> DIP 1003 is merged to the queue and open for public informal 
> feedback.
>
> PR: https://github.com/dlang/DIPs/pull/48
> Initial merged document: 
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1003.md
>
> If you want the change to be approved and have ideas how to 
> improve it to better match on 
> https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and 
> existing published reviews - please submit new PR with 
> editorial and ping original author.

This DIP fixes the problem for "body" but not for the other 
keywords. After all the problem may exist for other keywords. Was 
a new pragma considered ? For example an identifier alias.

pragma(idAlias, "body", "body_" )

would mean that any "body_" will be treated as "body" identifier. 
The translation would happen just after the grammatical parsing, 
because at this phase keywords don't matter anymore.

example:

====
module module_;

pragma(idAlias, "function", "function_" );
pragma(idAlias, "module", "module_" )

int function_()
{
     pragma(msg, __PRETTY_FUNCTION__);
     return 0;
}
====

prints "int module.function()" during compilation.



More information about the Digitalmars-d-announce mailing list