Re: Garbage collector - ccl:terminate (memory stuff)

GrĂ©gory Vanuxem <[email protected]> Sat, 4 May 2024 17:30:11 +0200
Newsgroups gmane.lisp.openmcl.devel
Message-ID <CAHnU2darpDmM-9t8gKRgy1NGXEsALxWTni2fEzmAHnOMZvn7Qg@mail.gmail.com>
Thanks, yes! I come in part from the Perl world, so I love the
TIMTOWTDI acronym ("there is more then one way to do it")


Le mer. 1 mai 2024 =C3=A0 22:16, Tim Bradshaw <[email protected]> a =C3=A9crit :
>
> Another approach to this is to simply reuse symbols that already are inte=
rned elsewhere, particularly CL:
>
> (do-symbols (symbol "FRICAS-LISP")
>   (export (list symbol) "FRICAS-LISP"))
>
> This is legal, and readable.
>
> Obscure note: you need (export (list s) ...) because otherwise at some po=
int you end up saying (export nil ...).
>
> --tim
>
> On 27 Apr 2024, at 13:37, Rainer Joswig <[email protected]> wrote:
>
> =EF=BB=BF
>
> Am 27.04.2024 um 13:41 schrieb Gr=C3=A9gory Vanuxem <[email protected]>=
:
>
>
> As a last note, there is a strange "routine" in the FRICAS-LISP
> package (BOOT, the interpreter and algebra libraries use it) that I do
> not really understand, wouldn't it be related? I can eventually "play"
> with this piece of code (some code parts are cutted below):
>
> (make-package "FRICAS-LISP"
>     :use (list (or (find-package "COMMON-LISP")
>                    "LISP")))
>
> Here is the piece of code I do not totally understand and if it has
> effect on CCL symbols that prevents me to define the ccl:terminate or
> ccl::terminate method on jlref object:
>
> ;;; We use uninterned symbols because at this point we do not
> ;;; want to add symbols to FRICAS-LISP
> (let ((#1=3D#:ls nil))
>    (do-symbols (#2=3D#:el "FRICAS-LISP") (setf #1# (cons #2# #1#)))
>    (mapcar (lambda (#3=3D#:x) (export (list #3#))) #1#)
> )
>
>
>
> The form above could be replaced by:
>
> (mapcar #'export (apropos-list "" "FRICAS-LISP"))
>
> It simply exports all symbols in the package "FRICAS-LISP" from the curre=
nt package at that point, avoiding interning new symbols by the code itself=
.
>
>
> If one want to control from where to export, then we can use this:
>
> (mapcar #'(lambda (#1=3D#:fricas-lisp-symbol) (export #1# "FRICAS-LISP"))
>               (apropos-list "" "FRICAS-LISP"))
>
>