- 论坛徽章:
- 2
|
本帖最后由 OwnWaterloo 于 2016-10-09 21:01 编辑
太长不看版: 坚持用小括号。 视觉上区分括号的工作交给编辑器。
R5RS 保留中括号、大括号以及管道符号。
2.3 Other notations
[ ] { } | Left and right square brackets and curly braces and vertical bar are reserved for possible future extensions to the language.
7.1.1 Lexical structure
The following five characters are reserved for future extensions to the language: [ ] { } |
<delimiter> → <whitespace> ∣ ( ∣ ) ∣ " ∣ ;
schemewiki的faq里也有一条:Is it legal to use square brackets instead of parentheses? 准确说明了使用中括号的坏处。
Thus, Schemes using the above convention are standards-compliant, but code written for them may not be readable by other implementations.
一个允许中括号以及大括号的实现是符合r5rs的。 但如果这样写的程序在别的r5rs上跑不起来, 是程序员自己的锅。
接着是引发混乱的 r6rs 。 允许中括号, 但依然保留大括号。
4.2 Lexical syntax
The following two characters are reserved for future extensions to the language: { }
<delimiter> → ( ∣ ) ∣ [ ∣ ] ∣ " ∣ ; ∣ # ∣ <whitespace>
官方对什么时候可以使用中括号的意见: Use of square brackets 。
最后是r7rs。
管道符号有了新的含义:
2.1. Identifiers
Alternatively, an identifier can be represented by a sequence of zero or more characters enclosed within vertical lines (|), analogous to string literals. Any character, including whitespace characters, but excluding the backslash and vertical line characters, can appear verbatim in such an identifier.
例如这个
是一个标识符。
又重新将中括号保留:
2.3. Other notations
[ ] { } Left and right square and curly brackets (braces)
are reserved for possible future extensions to the language.
r4rs, r3rs也明确保留中括号和大括号, 没提管道符号。 |
|