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?

  • paulfdietz@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

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

    • lispm@alien.topB
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 months ago

      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.topB
        link
        fedilink
        English
        arrow-up
        1
        ·
        11 months 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.