Feature Request: Keyword as identifier.

Don Clugston dac at nospam.com.au
Mon Oct 2 05:35:16 PDT 2006


icee wrote:
> In C# we can use a keyword as a identifier by prefixing @
> 
> Why?
> suppose we are using a extern C lib, the library exports a function as "int 
> version()",
> so we write:
>  extern(C) int version();
> this will obviously fail to compile, cos' version is a D keyword, (but not 
> the C keyword.)
> so we have no methods except modify the C code and re-compile it.

I proposed a keyword called 'identifier':

extern(C) int identifier("version")();

As well as solving this problem, it would add the most powerful 
remaining C preprocessor feature (token pasting) into the D template 
system. Serious magic. Although D has no shortage of magic already <g>.



More information about the Digitalmars-d mailing list