* tfb <11em…@dont-email.me> :
Wrote on Tue, 1 Dec 2026 17:22:12 -0000 (UTC):
> Anton Antimo <ant…@safunu.org> wrote:
>
>>
>> Why should I
>>
>> (in-package :cl-user)
>>
>> before defining my own package?
>
> When a file is loaded the package is initially whatever its ambient value
> was. Making it be CL-USER removes that uncertainty (to be more paranoid you
> might want to say (cl:in-package :cl-user)).
And so that the following defpackage form can be just be defpackage
instead of needing to be cl:defpackage.
evaluate-last-sexp in sly/slime searches backwards for an in-package
form (at column 0) and evaluates the expression in that package. So an
in-package cl-user at the top is a good idea for this.
>> And why should I define my own package to define my system?
>
>
> I generally define systems in ASDF-USER. But in the case you give it's not
> just systems being defined: it's other things as well: you likely want
> those in their own package, not some shared playground.
In this case the the code uses the configuration variable
cl-gd.system:*cl-gd-directory* which gets defined when loading the asd
file.
Personally I don't like the idea of defining configuration variables in
the system definition file. I'd just define that variable in a
config.lisp file that is loaded included in the system definition file
(.asd or .system)