From: MAEDA Atusi
Subject: Separate compilation in ISLisp (was Re: ISO/IEC CD 13816 -- ISLisp)
Date: 
Message-ID: <MAD.95Dec14163948@tanzanite.math.keio.ac.jp>
Any serious programming language should provide a way to develop
application in a modular manner.  That is, application should be written
as a set of separate files and merged together to form a complete program.

ISLisp Working Draft 15.6 states that:

"An ISLisp text consists of a sequence of toplevel forms." (1.7)
"An object is prepared for execution... The method of preparation for
execution and its result are not defined in this document ..." (1.3)

Now suppose there is an application program whose text is divided into
two files `module1' and `module2'.  Assume a global variable, say G,
is used from within both of these files.

Now where to place the definition of G?  May I write:
	(defglobal G ...)
in both files?  If not, how to tell compiler that G is global when
compiling files?

Dratft says "For each namespace, defining forms can occur at most once
for the same name ..." (4.4),  (in (DEFGLOBAL name form)) "The scope
of NAME is the entire current toplevel scope except the body FORM."
(4.8), "Each complete ISLisp text unit is precessed in a scope called
the TOPLEVEL SCOPE".

Here, the meaning of "complete ISLisp text unit" is not clearly
specified.  Which of the following is true?

(A) Each of files forms distinct toplevel scope.
(B) All files belongs to the same toplevel scope.

It is obvious that Interpretation (A) makes no sense.  We must share G
between two files.  Following interpretation (B), we must define G in
either of the files, but not both.  If we define G in the file
`module1', then how to tell the compiler that G is a global variable
when compiling `module2'?  We can't include implemenation specific
directive such as (REQUIRE "MODULE1"), since "A complying ISLisp text
shall not rely on implemenation-dependent features."(1.9).  ISLisp
doesn't provide portable #ifdef-like constructs (such as #+ and #- in
Common Lisp), either.

So we must tell compiler that `module2' depends on objects defined in
`module1' by ways other than program text.

A possible solution would be to provide interface file for each
module, describing what definition is exported from the module and
what is imported from other modules.  Syntax of such interface file is
of course totally implementation-dependent in current Draft.  But
since virtually all implemenation should have this kind of feature,
and most practical ISLisp program will have to rely on them, some kind
of module facility should be included in the standard.  Otherwise,
application writers are forced to provide interface definitions for
every possible ISLisp implementation.

				--mad