this post was submitted on 17 Oct 2023
1 points (100.0% liked)

Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
 

For example, I've seen someone defining a package like so:

(defpackage :foobar
  (:use :cl))

instead of:

(defpackage foobar
  (:use cl))

Is there any actual difference? Or it's just a personal preference, and has no effect on the program at all?

you are viewing a single comment's thread
view the rest of the comments
[–] paulfdietz@alien.top 1 points 1 year ago (1 children)

Using the string also means your code won't work in Allegro with its optional non-standard symbol reading.

[–] lispm@alien.top 1 points 1 year ago (1 children)

That's about the so-called "modern mode", where standard Common Lisp symbols internally have lower case names (which violates the Common Lisp standard) and the default readtable case is :preserve. In the standard it is :upcase. Also other predefined symbols have lowercase names.

https://franz.com/support/tutorials/casemode-tutorial.htm

Is that incompatible language change used by other implementations?

See CLHS 1.4.1.4.1 Case in Symbols: http://www.lispworks.com/documentation/HyperSpec/Body/01_dada.htm

  • "As such, case in symbols is not, by default, significant."

  • "The symbols that correspond to Common Lisp defined names have uppercase names"

[–] eadmund@alien.top 1 points 1 year ago

As an aside, I think that every Common Lisp implementation should support a modern mode. The upcasing behaviour of CL — defensible at the time — is in hindsight an easily-fixable mistake.