On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn 
> I would like to make sure that my modules do not interfere with d
> lang. Is there any  way to escape reserved words?
> https://dlang.org/spec/lex.html#keywords
> > import alias;
> C:\Users\Juozas\Desktop\om.d(2): Error: identifier expected
> following import
> C:\Users\Juozas\Desktop\om.d(2): Error: ; expected
> > module abstract;
> C:\Users\Juozas\Desktop\commands\alias.d(1): Error: identifier
> expected following module

You can never use keywords as identifiers in D (or any language in the C
family that I've ever heard of). So, you can't ever declare symbols with
names like alias or abstract. The way that the official D style guide
tackles the problem is to say that any case where a keyword would be needed
should append _ to the keyword to make it a legal identifier.


So, that's the way that it's handled in the standard library or any other
code which follows the D style guide. e.g. The enum
std.traits.FunctionAttribute has members such as pure_, nothrow_, and
const_, since it can't use the actual keywords.

- Jonathan M Davis

Reply via email to