On Wednesday, 19 June 2019 at 19:07:30 UTC, Jonathan M Davis wrote:
On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn wrote:
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).

C# can use them when they are prefixed with a little "@" before [1].
At some point the idea was brought for D [2].

[1] https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/index
[2] https://github.com/dlang/DIPs/pull/52/files

Reply via email to