在Common Lisp中,符号名称是否有定义的最大长度?

tex*_*aft 6 symbols common-lisp identifier language-lawyer

我在Hyperspec或Common Lisp:The Language(第二版)中找不到此信息。与实现相关的常量,例如LAMBDA-PARAMETERS-LIMITCALL-ARGUMENT-LIMIT,但不是SYMBOL-NAME-LENGTH-LIMITPRINTABLE-SYMBOL-NAME-MAX-LENGTH

名称最长的标准符号为UPDATE-INSTANCE-FOR-DIFFERENT-CLASSUPDATE-INSTANCE-FOR-REDEFINED-CLASS,均为35个字符长,因此我想最多可以使用35个字符。我不希望再为符号命名更长的名称,但这可能有一天会很重要。

rsm*_*rsm 12

In Common Lisp the names of symbols are strings, strings are vectors (one-dimensional arrays) and thus the length of strings is limited by array-dimension-limit.

According to CL HyperSpec http://www.lispworks.com/documentation/HyperSpec/Body/v_ar_dim.htm#array-dimension-limit array-dimension-limit is:

A positive fixnum, the exact magnitude of which is implementation-dependent, but which is not less than 1024.

Practically, SBCL reports

* array-dimension-limit
4611686018427387901
Run Code Online (Sandbox Code Playgroud)

so it's not really a limit.

  • 旁注:CLtL2并不是真正的规格。在指定为ANSI Common Lisp之前,这是Common Lisp版本的语言描述。因此,实际的ANSI CL规格有所不同。HyperSpec的内容与HTML内容基本相同的HTML呈现为:http://www.lispworks.com/documentation/HyperSpec/Front/Contents.htm (4认同)
  • @RainerJoswig哦,我不知道,谢谢!我将CLtL2部分更改为HyperSpec。 (3认同)