On 8/27/2016 6:36 AM, ZombineDev wrote:
As Timon said, this won't make the grammar context dependent. Also,
C# has the concept of contextual keywords. Such keywords have special meaning in
certain contexts but are otherwise available for use as identifiers. C# also
allows to use normal keywords as identifiers, but you have use the @for syntax
to disambiguate (e.g. see http://rextester.com/JBOTC21251). From my experience
of using C# the system is well designed and I have never seen problems in
practice. I'm sure something similar can successfully be implemented for D.
Though I would consider such enhancement with low priority.
See https://msdn.microsoft.com/en-us/library/x53a06bb.aspx for more info.
D has contextual keywords, too, and has had them since the beginning:
extern (C)
pragma (msg, ...)
scope (exit)
etc.
Microsoft has tried to patent contextual keywords in C#, but I don't think they
have a case.