This is a sister question to: Is it bad to use Unicode characters in variable names?
As is my wont, I'm working on a language project. The thought came to me that allowing multi-token identifiers might improve both readability and writability:
primary controller = new Data Interaction Controller();
# vs.
primary_controller = new DataInteractionController();
And whether or not you think that's a good idea*, it got me musing about how permissive a language ought to be about identifiers, and how much value there is in being so.
It's obvious that allowing characters outside the usual [0-9A-Za-z_]
has some advantages in terms of writability, readability, and proximity to the domain, but also that it can create maintenance nightmares. There seems to be a consensus (or at least a trend) that English is the language of programming. Does a Chinese programmer really need to be writing 电子邮件地址
when email_address
is the international preference?
I hate to be Anglocentric when it comes to Unicode, or a stickler when it comes to other identifier restrictions, but is it really worth it to allow crazy variable names?
tl;dr: Is the cost of laxity higher than the potential benefit?
Why or why not? What experiences and evidence can you share in favour of or opposed to relaxed restrictions? Where do you think is the ideal on the continuum?
* My argument in favour of allowing multi-token identifiers is that it introduces more sane points to break long lines of code, while still allowing names to be descriptive, and avoiding ExcessiveCamelCase
and a_whole_lot_of_underscores
, both of which are detrimental to readability.