Subject: [clisp-list] what should LOAD do when the FAS file is obsolete?

From: Sam Steingold <[email-masked]>
Date: Thu Sep 19 16:52:02 2002

Every now and then CLISP bytecode format changes.
(last time it was at version 2.28; it might happen again :-)
Suppose you compiled file "foo.lisp" with an older CLISP (so that
"foo.fas" has obsolete bytecode) and tell a new CLISP (LOAD "foo").

What should CLISP do?

Now it sees that there is no file "foo", so it looks in *LOAD-PATHS*
for "foo.lisp", "foo.fas", "foo.cl" and "foo.lsp" and tries to load the
newest of the found files, i.e., "foo.fas", and then signals an error.

CLISP can also do the following:

- issue a warning instead and load "foo.lisp"

- also delete "foo.fas" so that the next time there will be no warning
  (and a `make' will recompile "foo.lisp")

- recompile "foo.lisp" - this is very problematic: suppose you use
  DEFSYSTEM and you keep your LISP files in a different directory from
  the FAS files, then (COMPILE-FILE "foo.lisp") will not clobber the
  existing bad "foo.fas"; giving COMPILE-FILE the :OUTPUT-FILE argument
  is a dangerous solution for the following reason: suppose you have
  directories "zoo/" and "zot/" in your *LOAD-PATHS* and both
  directories hav "foo.lisp" in them (yes, this is not a very good idea
  in the first place).  The 4 files "foo.lisp" and "foo.fas" may have
  all combinations of timestamps.  So it is possible that we first see
  an invalid "zoo/foo.fas", and the second newest file is
  "zot/foo.lisp", and then we call (COMPILE-FILE "zot/foo.lisp" :OUTPUT-FILE
  "zoo/foo.fas") and we clobber a file in "zoo/" with the file which
  should be in "zot/".

A warning + optional removing the bad file appears to be the safest way.

What do people think?

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Bill Gates is great, as long as `bill' is a verb.

---

From: Adam Warner <[email-masked]>
Date: Thu Sep 19 18:03:03 2002

> A warning + optional removing the bad file appears to be the safest way.

I agree that you should issue a warning and load "foo.lisp" instead.
This should become a noted exception to loading the most recent file
rule.

I'm uneasy with CLISP deleting files by default. But an option to delete
old bytecode would be nice.

Regards,
Adam

---

From: "John K. Hinsdale" <[email-masked]>
Date: Thu Sep 19 18:15:02 2002

> "foo.fas" has obsolete bytecode) and tell a new CLISP (LOAD "foo").

I would behave consistenly with other compiled languages (e.g., say
an caused compiling "C" changed from 'a.out' to 'ELF') and either

    - support the old object format in a backward compatible way;
      (which is not really an option here to do effort/rewrd)

	or

    - signal an error.

So I guess I am saying signal an error.  To recompile automatically,
even with a warning, is to proceed in a mode (probably much slower)
and give the user "almost working" behavior, and possible a little
puzzle to have to solve why things got slower.

In other words, unless there is an announced change in the
functionality of CLISP (not the format) I'm arguing that he (the user)
should get exactly the behavior he had before, including the
performance of compiled modules.

That is just my knee-jerk one-minute response.  Perhaps there is a
middle ground of "automatically recompile, but only if an option is
set" and then we can argue about what should the default for that
option be :)

---
John Hinsdale, Alma Mater Software, Inc., Tarrytown, NY 10591-3710 USA
[email-masked] | http://www.alma.com/staff/hin | +1 914 631 4690

---

From: Marco Antoniotti <[email-masked]>
Date: Thu Sep 19 18:40:02 2002

> X-Sent: 19 Sep 2002 23:51:30 GMT
> X-Authentication-Warning: glip.premonitia.com: sds set sender to [email-masked] using -f
> Reply-To: [email-masked]
> Mail-Copies-To: never
> From: Sam Steingold <[email-masked]>
> Sender: [email-masked]
> X-Original-Date: 19 Sep 2002 18:39:54 -0400
> Date: 19 Sep 2002 18:39:54 -0400
> 

I think this is the sensible thing to do.  You should be prepared to
signal an error if "foo.lisp" is not available.

>   (and a `make' will recompile "foo.lisp")

I would not want this.  Suppose that you stil have an old copy of
CLisp which does use the older .fas.

>   "zoo/foo.fas") and we clobber a file in "zoo/" with the file which

Now... where is the lid of this can of worms?  I hope it is still on. :)

> A warning + optional removing the bad file appears to be the safest way.

See above.  You could also extend LOAD with some extra keyword, maybe
:delete-old-fas-files-p

Cheers

-- 
Marco Antoniotti ========================================================
NYU Courant Bioinformatics Group        tel. +1 - 212 - 998 3488
715 Broadway 10th Floor                 fax  +1 - 212 - 995 4122
New York, NY 10003, USA                 http://bioinformatics.cat.nyu.edu
                    "Hello New York! We'll do what we can!"
                           Bill Murray in `Ghostbusters'.

---

From: Sam Steingold <[email-masked]>
Date: Mon Sep 23 06:39:03 2002

I implemented something now - please read
<http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/clisp/clisp/doc/impnotes.html?rev=HEAD&content-type=text/html#loadfile>
and try CVS HEAD.
comments are welcome.
thanks.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.3 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Never succeed from the first try - if you do, nobody will think it was hard.