common-lispsbclclisp

What symbols are interned in the KEYWORD package by default?


What keywords are interned in the KEYWORD package by default? I noticed some differences between SBCL and CLISP's initial interned keywords right after I start their REPLs. Are the default interned symbols in the KEYWORD package supposed to vary between implementations?

In SBCL:

(find-symbol "CL" "KEYWORD")                ; -> :CL, :EXTERNAL
(find-symbol "CL-USER" "KEYWORD")           ; -> :CL-USER, :EXTERNAL
(find-symbol "COMMON-LISP" "KEYWORD")       ; -> :COMMON-LISP, :EXTERNAL
(find-symbol "COMMON-LISP-USER" "KEYWORD")  ; -> NIL, NIL

In CLISP:

(find-symbol "CL" "KEYWORD")                ; -> NIL, NIL
(find-symbol "CL-USER" "KEYWORD")           ; -> NIL, NIL
(find-symbol "COMMON-LISP" "KEYWORD")       ; -> :COMMON-LISP, :EXTERNAL
(find-symbol "COMMON-LISP-USER" "KEYWORD")  ; -> NIL, NIL

Solution

  • What keywords are interned in the KEYWORD package by default?

    Any which the implementation wants/needs. Remember, a Lisp implementation may include a compiler, an I/O system, an object system, interfaces to the operating system, development tools, ways to do networking, graphics libraries, terminal libraries,...

    Each of those (implementation, library, extension, ...) may use keywords in their implementation code. Since there is only one keyword package, all keywords end up in this same package.

    Neither in the standard, nor by convention, there are expectations what symbols are present in the keyword package - beyond those which may be mentioned in the standard.