# 12.2 常量变量

在 Emacs Lisp 中，有些特定的符号求值后得到的结果之它本身。比如 nil 和 t ，以及由 ':' 作为开端的符号（这些符号称为 关键字）这符号既不能被重新绑定新的值，也不能修改它们的值 (value)。任何尝试给 nil 和 t 绑定新值的操作都会抛出 setting-constant 错误。如果关键字符号在标准 obarray 中 interned 了，那么这个规则同样适合关键字符号。

```
nil = 'nil
    => nil
(setq nil 500)
error -> Attempt to set constant symbol: nil
```

Function: keywordp object\
&#x20; 如果 object 在 标准 obarray 中 interned 且一个以 ':' 开头的符号，则会返回 t。其他情况返回 nil。

这些常量变量和 使用特殊表达式 defconst 定义的常量变量在底层是不同的。 defconst 主要用于定义方便人类阅读，且不期望被修改的变量。不过需要注意的是， 当你尝试修改这种常量变量时， Emacs 并不会抛出任何错误。

还有一小部分额外的符号被设计为只读，但是是因为其他的一些原因。比如： enable-multibyte-characters, most-positive-fixnum, most-negative-fixnum,等等。任何修改绑定或重设新值的操作都会抛出 setting-constant 错误。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emacs-lisp.ivory.cafe/bian-liang/chang-liang-bian-liang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
