[PATCH] reset *GENSYM-COUNTER* during initialization

5 views
Skip to first unread message

Qian Yun

unread,
Oct 14, 2023, 6:21:36 AM10/14/23
to fricas-devel
This patch set variable *GENSYM-COUNTER* to 0 during initialization.

The purpose is to make the generation of compiled lisp files more
consistent between commits. (The names of gensyms will be more
consistent.)

More precisely, this help "fricas0-repo" project, which aims to
have minimal changes of compiled lisp files between commits.
One such example is e8f563f6, one additional GENSYM() causes over 24k
lines of difference in the resulting lisp files.

In a way, this is also a very small step towards reproducible builds.

- Qian

====

diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index 4a60b338..06504deb 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -293,6 +293,7 @@ After this function is called the image is clean and
can be saved.
(if (fboundp 'si::readline-off)
(si::readline-off))
(setq |$SpadServer| t)))))
+ (setq *GENSYM-COUNTER* 0)
(|interpsys_restart|)
)

Waldek Hebisch

unread,
Oct 14, 2023, 5:12:17 PM10/14/23
to fricas...@googlegroups.com
On Sat, Oct 14, 2023 at 06:21:29PM +0800, Qian Yun wrote:
> This patch set variable *GENSYM-COUNTER* to 0 during initialization.
>
> The purpose is to make the generation of compiled lisp files more
> consistent between commits. (The names of gensyms will be more
> consistent.)
>
> More precisely, this help "fricas0-repo" project, which aims to
> have minimal changes of compiled lisp files between commits.
> One such example is e8f563f6, one additional GENSYM() causes over 24k
> lines of difference in the resulting lisp files.
>
> In a way, this is also a very small step towards reproducible builds.

I wonder if you really want this. To have somewhat repeatable
names of gensyms one probably should reset gensym counter before
each compilation.

OTOH reseting counter means that gensym names will repeat,
I am not sure how this affects readability/debugablity of
generated Lisp. Note that except for cached Boot code,
generated Lisp could be deleted immediately after Lisp
compilation. Main reason to keep it is debugging.

--
Waldek Hebisch

Qian Yun

unread,
Oct 14, 2023, 7:54:02 PM10/14/23
to fricas...@googlegroups.com


On 10/15/23 05:12, Waldek Hebisch wrote:
> On Sat, Oct 14, 2023 at 06:21:29PM +0800, Qian Yun wrote:
>> This patch set variable *GENSYM-COUNTER* to 0 during initialization.
>>
>> The purpose is to make the generation of compiled lisp files more
>> consistent between commits. (The names of gensyms will be more
>> consistent.)
>>
>> More precisely, this help "fricas0-repo" project, which aims to
>> have minimal changes of compiled lisp files between commits.
>> One such example is e8f563f6, one additional GENSYM() causes over 24k
>> lines of difference in the resulting lisp files.
>>
>> In a way, this is also a very small step towards reproducible builds.
>
> I wonder if you really want this. To have somewhat repeatable
> names of gensyms one probably should reset gensym counter before
> each compilation.

When building algebra/, most files are compiled by a freshly loaded
"interpsys" individually.

> OTOH reseting counter means that gensym names will repeat,
> I am not sure how this affects readability/debugablity of
> generated Lisp. Note that except for cached Boot code,
> generated Lisp could be deleted immediately after Lisp
> compilation. Main reason to keep it is debugging.
>

Current *GENSYM-COUNTER* is 104, so gensyms are already getting
repeated starting with this number.

- Qian

Waldek Hebisch

unread,
Oct 15, 2023, 1:20:24 PM10/15/23
to fricas...@googlegroups.com
On Sun, Oct 15, 2023 at 07:53:57AM +0800, Qian Yun wrote:
>
>
> On 10/15/23 05:12, Waldek Hebisch wrote:
> > On Sat, Oct 14, 2023 at 06:21:29PM +0800, Qian Yun wrote:
> > > This patch set variable *GENSYM-COUNTER* to 0 during initialization.
> > >
> > > The purpose is to make the generation of compiled lisp files more
> > > consistent between commits. (The names of gensyms will be more
> > > consistent.)
> > >
> > > More precisely, this help "fricas0-repo" project, which aims to
> > > have minimal changes of compiled lisp files between commits.
> > > One such example is e8f563f6, one additional GENSYM() causes over 24k
> > > lines of difference in the resulting lisp files.
> > >
> > > In a way, this is also a very small step towards reproducible builds.
> >
> > I wonder if you really want this. To have somewhat repeatable
> > names of gensyms one probably should reset gensym counter before
> > each compilation.
>
> When building algebra/, most files are compiled by a freshly loaded
> "interpsys" individually.

OK, if you think that this is enough, then go on.

> > OTOH reseting counter means that gensym names will repeat,
> > I am not sure how this affects readability/debugablity of
> > generated Lisp. Note that except for cached Boot code,
> > generated Lisp could be deleted immediately after Lisp
> > compilation. Main reason to keep it is debugging.
> >
>
> Current *GENSYM-COUNTER* is 104, so gensyms are already getting
> repeated starting with this number.
>

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