Why is Common Lisp case insensitive?

后端 未结 4 1285
日久生厌
日久生厌 2020-12-09 09:41

Is there an advantage to defining a function like (defun hi () \"Hi!\") and be able to call it by using (hi) or (HI) or (Hi)

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-09 10:27

    (As others have pointed out, it is actually case-sensitive, but standard reader behaviour is to upcase everything.)

    As to the advantages:

    • Do you really want Hashtable and HashTable to be naming different things?
    • Since Common Lisp provides different namespaces, you also do not need capitalization to tell class, variable, and function names apart (among others). You can have a class name and a function name with no ambiguity. Name can even be the name of a variable, on top of that.
    • As seen in the last sentence, you can capitalize symbol names in prose just like any other words.

提交回复
热议问题