Why does Java allow control characters in its identifiers?

后端 未结 3 932
梦如初夏
梦如初夏 2020-12-23 17:44

The Mystery

In exploring precisely which characters were permitted in Java identifiers, I have stumbled upon something so extremely curious that it seems nearly ce

3条回答
  •  清歌不尽
    2020-12-23 18:04

    The Java Language Specification section 3.8 defers to Character.isJavaIdentifierStart() and Character.isJavaIdentifierPart(). The latter, among other conditions, has Character.isIdentifierIgnorable(), which allows non-whitespace control characters (including whole C1 range, see the link for the list).

提交回复
热议问题