[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] clisp and sbcl

From: Waldek Hebisch
Subject: Re: [Axiom-developer] clisp and sbcl
Date: Mon, 28 May 2007 16:24:17 +0200 (CEST)

> On Mon, 28 May 2007, Waldek Hebisch wrote:
> | It looks for me that replacing SETQ by DEFPARAMETER defeats much of the
> | purpose of DEFPARAMETER/DEFVAR: we silence _all_ warnings about assignments
> | to undefined variables, loosing them also when variable name is
> | spelled incorrectly.
> The replacement was for variable definitions at top level, NOT every use
> of SETQ.  All of those should have been DEFPARAMETERs in the first place.
> If you see multiple SETQ at toplevel for the same variable, that is a 
> logical bug, and is independent of whether you use SETQ or DEFPARAMTER.

OK, for each variable used in multiple file we should have one
unintialized DEFVAR in some "header" file and SETQ at place of
definition.  The first DEFVAR will silence warnings about uses
in other files while SETQ will catch misspeled names.  
> |  I would prefer to have in a _single_ place explicit
> | DEFVAR/DEFPARAMETER declaration and in all other places use SETQ.
> I don't think it makes much sense from logical code locality and organization
> to put all definitions in one files as is done in setq.lisp or varini.boot.
> Doing that put unrelated things together, remove the variable definition from
> where it is logically confined to some unrelated place.
> For example, you organize the current code base to make appearant the logical
> units, then you'll find out that variables are defined in the wrong place.
> Putting them with the codes they belong to is more logical.
> $nopos, for example, should not be defined in varini.boot.  It belongs to
> posit.boot. 

Yes, you have good point here.  But I am affraid that due to Lisp
limited (rather low-level) support for modularity we need DEFVAR is
separate place.  I fully agree that SETQ should go in logical
place, but it is not clear for me what is the best way to do it.
One possibility is to use noweb to extract "init chunks" and put
them in separate file (from my point of view it is one of rare
cases when noweb chunks may improve readability).  Another
possibility is to maintain a separate file with uninitialised
DEFVARs (something like C file with extern declarations).

> We don't have a file "call.boot" for all function calls we make, for
> "eq-comparison.boot" for all "eq compare" we do.  Let's organize the codes
> logically.

For calls we have (unfortunatly GCL specific) interp-proclaims.lisp.
Special forms are predefined.  Most of macros is expanded during compilation
(and the ones which are not are not visible to the compiler anyway).
So call and variable access are only "interesting" cases where we
reference global values bound to symbols.  "Interesting" here means
that the Lisp compiler can issue sensible diagnostics about
undefined values.

                              Waldek Hebisch

reply via email to

[Prev in Thread] Current Thread [Next in Thread]