6

I wasn't able to find this information in the Hyperspec or Common Lisp: The Language (second edition). Implementation-dependent constants like LAMBDA-PARAMETERS-LIMIT and CALL-ARGUMENT-LIMIT, but not something like SYMBOL-NAME-LENGTH-LIMIT or perhaps PRINTABLE-SYMBOL-NAME-MAX-LENGTH.

The standard symbols with the longest names are UPDATE-INSTANCE-FOR-DIFFERENT-CLASS and UPDATE-INSTANCE-FOR-REDEFINED-CLASS, both 35 characters long, so I suppose that 35 could be taken as a maximum. I don't expect to ever name a symbol something longer than that, but it could matter some day.

texdr.aft
  • 274
  • 2
  • 10

1 Answers1

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

so it's not really a limit.

rsm
  • 2,530
  • 4
  • 26
  • 33
  • 5
    Side note: CLtL2 is not really spec. It's a language description of a version of Common Lisp before it was specified as ANSI Common Lisp. Thus there are differences to the actual ANSI CL spec. A HTML rendering of something which has basically the same contents as the spec is the HyperSpec: http://www.lispworks.com/documentation/HyperSpec/Front/Contents.htm – Rainer Joswig Jul 29 '19 at 15:31
  • 4
    @RainerJoswig Oh, I didn't knew that, thanks! I changed CLtL2 part to HyperSpec. – rsm Jul 29 '19 at 17:02