list of unused global variables

13 views
Skip to first unread message

Qian Yun

unread,
Nov 26, 2023, 4:31:02 AM11/26/23
to fricas-devel
The 'XREF' utility provided by CMUCL and SBCL (sb-introspect) doesn't
work very well. The one from Lispworks is better.

The following list comes from this command and is manually filtered:

)lisp (do-symbols (s "BOOT") (and (boundp s) (not (hcl:who-references
s)) (not (hcl:who-binds s)) (not (hcl:who-sets s)) (not (constantp s))
(print s)))

LABLASOC
$NONBLANK
|$constructorDataTable|
|$charTab|
|$ancestor_hash| -- should be |$ancestors_hash|?
|$countAssoc|
|$fortIndent| -- replaced by fort_indent, ')set fort fortindent' no effect
|$printFortranDecs| -- ")set fort typedecs" no effects?
|$historyDisplayWidth| -- ")set hyper mathwidth" no effects?
|$do_not_compress_databases|
|$newline| -- there's also |$Newline|
|$giveExposureWarning| -- ')set mes expose on' no effect?
|$hashPercent| -- using locally defined hashPercent instead
|$exposeDocHeading|
|$cacheMessages|
$PRETTYPRINT -- there's also |$PrettyPrint|, ")set sys prettyprint" no
effect
|$gcTimeTotal|

- Qian

Andrey G. Grozin

unread,
Nov 26, 2023, 4:37:53 AM11/26/23
to fricas-devel
Can you share this file somewhere, and provide an instruction on where to
put it and how to proceed?

Andrey

>
> - Qian
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fricas-devel/95ac70d1-4adb-464f-830b-a5b3cd00ff28%40gmail.com.
>
>

Qian Yun

unread,
Nov 26, 2023, 4:44:08 AM11/26/23
to fricas...@googlegroups.com
Use this repo https://github.com/oldk1331/fricas0

(Since I was using the free/"Personal" edition of Lispworks, it can't
dump image, so can't build fricas the normal way.)

Launch lispworks in this directory, type '(load "fricas")', then type

)lisp (do-symbols (s "BOOT") (and (boundp s) (not (hcl:who-references
s)) (not (hcl:who-binds s)) (not (hcl:who-sets s)) (not (constantp s))
(print s)))

And you get the list of unused variables. Note that some are false
positives. Need to verify manually and decide whether it is really
not used.

- Qian

Andrey G. Grozin

unread,
Nov 26, 2023, 4:58:42 AM11/26/23
to fricas...@googlegroups.com
On Sun, 26 Nov 2023, Qian Yun wrote:
> Launch lispworks in this directory, type '(load "fricas")', then type
>
> ) lisp (do-symbols (s "BOOT") (and (boundp s) (not (hcl:who-references
> s)) (not (hcl:who-binds s)) (not (hcl:who-sets s)) (not (constantp s)) (print
> s)))
Can ecl do this? I already have it installed.

The second question: how can I guess which are false positives?

Andrey

Qian Yun

unread,
Nov 26, 2023, 5:01:36 AM11/26/23
to fricas...@googlegroups.com


On 11/26/23 17:58, Andrey G. Grozin wrote:
> On Sun, 26 Nov 2023, Qian Yun wrote:
>> Launch lispworks in this directory, type '(load "fricas")', then type
>>
>> ) lisp (do-symbols (s "BOOT") (and (boundp s) (not (hcl:who-references
>> s)) (not (hcl:who-binds s)) (not (hcl:who-sets s)) (not (constantp s))
>> (print s)))
> Can ecl do this? I already have it installed.

No. This functionality is not standard, it relies on the internals of
compiler.

> The second question: how can I guess which are false positives?
>
> Andrey
>

You search the symbol through source code, and decide.
Also can check with "git log -S" to see when it was added/modified,
and if it was leftover of a previous cleanup.

- Qian

Waldek Hebisch

unread,
Nov 26, 2023, 6:01:34 AM11/26/23
to fricas...@googlegroups.com
On Sun, Nov 26, 2023 at 05:30:59PM +0800, Qian Yun wrote:
> The 'XREF' utility provided by CMUCL and SBCL (sb-introspect) doesn't
> work very well. The one from Lispworks is better.
>
> The following list comes from this command and is manually filtered:
>
> )lisp (do-symbols (s "BOOT") (and (boundp s) (not (hcl:who-references s))
> (not (hcl:who-binds s)) (not (hcl:who-sets s)) (not (constantp s)) (print
> s)))

AFAICS:

> LABLASOC
old code, should be removed
> $NONBLANK
old code, should be removed
> |$constructorDataTable|
should be removed
> |$charTab|
old code, should be removed
> |$ancestor_hash| -- should be |$ancestors_hash|?
yes
> |$countAssoc|
remove
> |$fortIndent| -- replaced by fort_indent, ')set fort fortindent' no effect
I would leave it as is, need to decide if we want to fix it or
remove the setting
> |$printFortranDecs| -- ")set fort typedecs" no effects?
the same
> |$historyDisplayWidth| -- ")set hyper mathwidth" no effects?
the same
> |$do_not_compress_databases|
probably remove
> |$newline| -- there's also |$Newline|
remove
> |$giveExposureWarning| -- ')set mes expose on' no effect?
would leave it as is
> |$hashPercent| -- using locally defined hashPercent instead
remove
> |$exposeDocHeading|
remove
> |$cacheMessages|
remove
> $PRETTYPRINT -- there's also |$PrettyPrint|, ")set sys prettyprint" no
> effect
change to |$PrettyPrint|
> |$gcTimeTotal|
you worked on this, see how it fits

--
Waldek Hebisch

Qian Yun

unread,
Nov 26, 2023, 6:06:32 AM11/26/23
to fricas...@googlegroups.com
OK, I'll make the change, not remove the setting variables.

About |$gcTimeTotal|: it's useless, the total time spent in GC
is returned by "elapsedGcTime()".

- Qian
Reply all
Reply to author
Forward
0 new messages