[PATCH] fix sbcl warnings on "EVAL-WHEN"

8 views
Skip to first unread message

Qian Yun

unread,
Aug 30, 2022, 5:57:57 AM8/30/22
to fricas-devel
When using scbl to load fricas0, there are many warnings:

STYLE-WARNING: using deprecated EVAL-WHEN situation names LOAD EVAL

I found that's from src/boot/ptyout.boot:

shoeEVALANDFILEACTQ x== ["EVAL-WHEN", ["EVAL","LOAD"], x]

However I can not directly replace "EVAL" with ":EXECUTE", because it
will translate into |:EXECUTE|. So I have to do it in lisp file as
following.

If there's no better solution, I will commit this patch together with
updated src/boot/compiled/*.clisp.

- Qian


diff --git a/src/boot/initial-env.lisp b/src/boot/initial-env.lisp
index 165e5268..c8647e8c 100644
--- a/src/boot/initial-env.lisp
+++ b/src/boot/initial-env.lisp
@@ -177,3 +177,6 @@

(defun |last| (x)
(car (last x)))
+
+(defun SHOEEVALANDFILEACTQ1 (x)
+ `(eval-when (:execute :load-toplevel) ,x))
diff --git a/src/boot/ptyout.boot b/src/boot/ptyout.boot
index 4ddebed7..96874efc 100644
--- a/src/boot/ptyout.boot
+++ b/src/boot/ptyout.boot
@@ -336,7 +336,7 @@ bpOutItem()==
b:=shoeCompTran ["LAMBDA",["x"],b]
bpPush [shoeEVALANDFILEACTQ CADDR b]

-shoeEVALANDFILEACTQ x== ["EVAL-WHEN", ["EVAL","LOAD"], x]
+shoeEVALANDFILEACTQ x == SHOEEVALANDFILEACTQ1 x

SoftShoeError(posn,key)==
shoeConsole CONCAT('"ERROR IN LINE ",STRINGIMAGE lineNo posn)

Waldek Hebisch

unread,
Aug 30, 2022, 7:22:02 PM8/30/22
to fricas...@googlegroups.com
On Tue, Aug 30, 2022 at 05:56:05PM +0800, Qian Yun wrote:
> When using scbl to load fricas0, there are many warnings:
>
> STYLE-WARNING: using deprecated EVAL-WHEN situation names LOAD EVAL
>
> I found that's from src/boot/ptyout.boot:
>
> shoeEVALANDFILEACTQ x== ["EVAL-WHEN", ["EVAL","LOAD"], x]
>
> However I can not directly replace "EVAL" with ":EXECUTE", because it
> will translate into |:EXECUTE|.

In Boot Lisp :EXECUTE has to be written as:

INTERN('"EXECUTE", FIND_-PACKAGE("KEYWORD"))


OTOH in build log I find 310 messages like this, 7718 messages about
undefined functions and 2950 messages about undefined variables.
Lisp allows declaring functions, but when I checked it had no
effect on sbcl warnings. Since our code is highly recursive
apparently there is no way to fully elliminate those warnigs.
Also, trying to define functions before use would break logical
decompositions in layers. Lispers say 'no problem, use
MUFFLE-WARNING'. I do not want to do this in regular FriCAS
source as _sometimes_ those warnings give useful information,
and due to overall chatter I have to use searches to find
correct place anyway. But for fricas0 MUFFLE-WARNING may be
useful.

--
Waldek Hebisch

Qian Yun

unread,
Aug 30, 2022, 8:18:46 PM8/30/22
to fricas...@googlegroups.com


On 8/31/22 07:22, Waldek Hebisch wrote:
> OTOH in build log I find 310 messages like this, 7718 messages about
> undefined functions and 2950 messages about undefined variables.

Well, this is about fricas0, it already uses MUFFLE-WARNING when
loading algebra lisp files. For this patch, the purpose is to
eliminate warnings from loading lisp files in interp/.

Also, for this particular warning, "deprecated EVAL-WHEN situation
names LOAD EVAL", I think this is "warnings give useful information",
and we should fix it.

This deprecation comes from EVAL-WHEN-OBSOLETE-KEYWORDS:X3J13-MAR-1993,
it's almost 30 years, also we use newer keywords everywhere else,
so for consistency purposes we should fix it.

- Qian

Qian Yun

unread,
Aug 30, 2022, 11:53:47 PM8/30/22
to fricas...@googlegroups.com
Further more, I found that open-axiom has eliminated those
"EVAL-WHEN" in toplevel assignments by commit
68d5315c2d9a8c1526a6af824f52f84485f16257, which translates to
this for our codebase:

--- a/src/boot/ptyout.boot
+++ b/src/boot/ptyout.boot
@@ -330,13 +330,13 @@ bpOutItem()==
EQCAR(b,"TUPLE")=> bpPush cdr b
EQCAR(b,"+LINE")=> bpPush [ b ]
b is ["L%T",l,r] and IDENTP l =>
- bpPush [shoeEVALANDFILEACTQ ["SETQ",l,r]]
+ bpPush [["SETQ",l,r]]
MEMQ(CAR(b), '(SETANDFILEQ SETQ DEFPARAMETER DEFCONSTANT DEFVAR)) =>
bpPush [ b ]
b:=shoeCompTran ["LAMBDA",["x"],b]
bpPush [shoeEVALANDFILEACTQ CADDR b]

- Qian

Waldek Hebisch

unread,
Sep 2, 2022, 3:41:33 PM9/2/22
to fricas...@googlegroups.com
On Wed, Aug 31, 2022 at 11:51:57AM +0800, Qian Yun wrote:
> Further more, I found that open-axiom has eliminated those
> "EVAL-WHEN" in toplevel assignments by commit
> 68d5315c2d9a8c1526a6af824f52f84485f16257, which translates to
> this for our codebase:
>
> --- a/src/boot/ptyout.boot
> +++ b/src/boot/ptyout.boot
> @@ -330,13 +330,13 @@ bpOutItem()==
> EQCAR(b,"TUPLE")=> bpPush cdr b
> EQCAR(b,"+LINE")=> bpPush [ b ]
> b is ["L%T",l,r] and IDENTP l =>
> - bpPush [shoeEVALANDFILEACTQ ["SETQ",l,r]]
> + bpPush [["SETQ",l,r]]
> MEMQ(CAR(b), '(SETANDFILEQ SETQ DEFPARAMETER DEFCONSTANT DEFVAR)) =>
> bpPush [ b ]
> b:=shoeCompTran ["LAMBDA",["x"],b]
> bpPush [shoeEVALANDFILEACTQ CADDR b]

ATM I can not say if this is good change. In principle there is
risc of subtle breakage, one would have to check Lisp rules and
our use to see if it is OK.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages