这样命名变量是否被接受?
Is it accepted to name a variable like this?
这样命名变量的可接受程度:
int Δt = 3;
而不是:
int timeDuration = 3;
我喜欢 Delta 字符....但是,只有当它成为代码中可维护的标准时,它才可以接受,这样您或您的团队就可以确切地知道它是什么 - 而且您永远不会混淆符号。
它可能会起作用,但我绝对不会在个人项目以外的任何地方推荐它。
诸如不同的编码语言(UTF 等)之类的事情会影响这些类型的 unicode 字符。还有一个事实是,可靠地键入而不是真正意义上的语义很混乱。
PHP 等语言具有针对 vars
的这些准则:
Variable names follow the same rules as other labels in PHP. A valid
variable name starts with a letter or underscore, followed by any
number of letters, numbers, or underscores. As a regular expression,
it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'
这样命名变量的可接受程度:
int Δt = 3;
而不是:
int timeDuration = 3;
我喜欢 Delta 字符....但是,只有当它成为代码中可维护的标准时,它才可以接受,这样您或您的团队就可以确切地知道它是什么 - 而且您永远不会混淆符号。
它可能会起作用,但我绝对不会在个人项目以外的任何地方推荐它。 诸如不同的编码语言(UTF 等)之类的事情会影响这些类型的 unicode 字符。还有一个事实是,可靠地键入而不是真正意义上的语义很混乱。
PHP 等语言具有针对 vars
的这些准则:
Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*'