Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持utf8变量名 #2671

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

支持utf8变量名 #2671

wants to merge 1 commit into from

Conversation

yybbwc
Copy link
Contributor

@yybbwc yybbwc commented Feb 13, 2025

#if defined (LUA_UCID)		/* accept UniCode IDentifiers? */
/* consider all non-ascii codepoints to be alphabetic */
#define NONA		0x01
#else
#define NONA		0x00	/* default */
#endif

@purerosefallen
Copy link
Collaborator

purerosefallen commented Feb 14, 2025

Please proof that:

  1. It works.
  2. No side effects, or properly handled.
  3. It does not cause performance issues.
  4. It does not contribute to other community member writing lua scripts with Chinese or other non-latin-based language variable names.
  5. It makes some improvements in the community.

@yybbwc
Copy link
Contributor Author

yybbwc commented Feb 14, 2025

Please prove that:

  1. It works.
  2. No side effects, or properly handled.
  3. It does not cause performance issues.
  4. It does not contribute to other community member writing lua scripts with Chinese or other non-latin-based language variable names.
  5. It makes some improvements in the community.
  • 能工作(大概)
  • 副作用,我没想到
  • 基本没性能问题
  • 可能有小部分人会采用非英文变量名
  • 对社区没有促进,因为更大的选择范围意味着分裂

@salix5
Copy link
Collaborator

salix5 commented Feb 15, 2025

與英文相比,CJK漢字用在變數名稱可能的問題:

  • 輸入更困難
  • 讀音相同的字元更多
  • 部分字元只能用音調的細微差異區分
  • 存在多個字形不同的分枝(簡體、繁體、日文漢字)

這些特性出現在程式碼可能會創造更多問題
我個人並不建議

@yybbwc
Copy link
Contributor Author

yybbwc commented Feb 15, 2025

與英文相比,CJK漢字用在變數名稱可能的問題:

  • 輸入更困難
  • 讀音相同的字元更多
  • 部分字元只能用音調的細微差異區分
  • 存在多個字形不同的分枝(簡體、繁體、日文漢字)

這些特性出現在程式碼可能會創造更多問題
我個人並不建議

c++本身支持中文变量,java也是,luajit也是。
ygopro采用支持中文变量的c++,但仍然保持了一致的英文变量名,可见utf8变量名功能属于鸡肋。

但我写个人代码时,仍总有采用中文变量名的冲动……

https://www.zhihu.com/answer/3152702983

在知乎上,有许多关于中文变量名的争论。
我想,有争论就意味着人群意见不一,各有各的见解。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants