Article View: comp.lang.lisp
Article #108Re: usage of in-package and defsystem
From: Madhu
Date: Tue, 01 Dec 2026 18:04
Date: Tue, 01 Dec 2026 18:04
39 lines
2466 bytes
2466 bytes
* tfb <11emvo4$1uu33$1@dont-email.me> : Wrote on Tue, 1 Dec 2026 17:22:12 -0000 (UTC): > Anton Antimo <anton@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)
Technical Details
Message-ID:
<m3cxrk7u92.fsf@pison.robolove.meer.net>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<87tskx8434.fsf@safunu.org> <11emvo4$1uu33$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Madhu <enometh@meer.net> Newsgroups: comp.lang.lisp Subject: Re: usage of in-package and defsystem Date: Tue, 01 Dec 2026 23:34:09 +0530 Organization: Motzarella Lines: 39 Message-ID: <m3cxrk7u92.fsf@pison.robolove.meer.net> References: <87tskx8434.fsf@safunu.org> <11emvo4$1uu33$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 01 Dec 2026 18:04:11 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2080188"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rkyZcMEo1fAh14MaFxO+OfhA4Iq4Egi4="; posting-host="8220ad7bb7cd4a38663ae2b836840901" Cancel-Lock: sha1:pHB+ZcztMfeJ0RHjTnI19B4IV50= sha1:2GNkfCP3qphQYBXxpYvlkIETgfs= sha256:e6jYHhmG3upwNgNWD6kFUCkZGvc7OitfA4SPT1eUq6I= sha1:9tnFeDHUZgTxIhXG4nGw2Aog6+Y= sha256:cX90/8Onum7EUcbYi5Qo4PFy3So4zLzGca+KRrhn7hw=