Why not extend do to allow unicode in ID's?

rikki cattermole rikki at cattermole.co.nz
Tue Jul 2 02:56:55 UTC 2019


On 02/07/2019 2:17 PM, Jonathan M Davis wrote:
> On Saturday, June 29, 2019 4:38:06 PM MDT Bert via Digitalmars-d wrote:
>> It would greatly expand the coverage.
>>
>> It would be nice to use certain characters that are truly
>> meaningful.
> ...
> 
> Like most major languages, D supports identifiers with alphanumeric
> characters plus underscore with the first character not being allowed to be
> numeric. However, unlike most languages, it expands that to include Unicode
> alpha characters, meaning that quite a lot of Unicode is supported in
> identifiers. So, it already goes far beyond what most languages do.
> 
> That being said, I think that you'll find that most folks will not be in
> favor of using Unicode in identifiers outside of code intended for people of
> a specific language who actually use those characters normally (e.g.
> Japanese characters when all of the programmers involved read and write
> Japanese and have keyboards that support it). The fact that a character is
> not a key on a typical keyboard means that anyone using an identifier with
> that charater in it will almost certainly have to copy-paste it, and that's
> really not going to over well with most people. If you really feel strongly
> about the matter, you can always create a DIP to propose a language change
> to allow more Unicode characters in identifiers, but I would not expect it
> to be accepted.
> 
> - Jonathan M Davis

No DIP is required. The lexer just needs updating to match to the 
(current) Unicode spec.

https://github.com/dlang/dmd/blob/master/src/dmd/lexer.d#L1082



More information about the Digitalmars-d mailing list