[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: PROCLAIM-SCOPE (Version 1)
- To: CL-Cleanup@SAIL.Stanford.EDU
- Subject: Issue: PROCLAIM-SCOPE (Version 1)
- From: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Date: Wed, 31 Aug 88 19:21 EDT
- Cc: KMP@STONY-BROOK.SCRC.Symbolics.COM
As indicated in the discussion below, I think this is really a rough
cut, but I think the issue it treats is a real one so I figured I'd
see what others think.
-kmp
-----
Issue: PROCLAIM-SCOPE
References: PROCLAIM (pp156-157)
Category: ADDITION
Edit history: 26-Aug-88, Version 1 by Pitman
Status: For Internal Discussion
Problem Description:
It would be useful to be able to do PROCLAIM without worrying about cleaning
up afterward. For example, a file containing:
In some cases, such as SPECIAL, there is no way to disable the effect of a
proclamation.
In other cases, such INLINE and SAFETY, it is possible but inconvenient to
change the declaration later. Even so, there is no way of inquiring about the
previous value in order to correctly restore it.
Proposal (PROCLAIM-SCOPE:ADD-KEYWORD-PERVASIVE):
Introduce a :LOCALLY keyword parameter to PROCLAIM which controls
the scope of a proclamation.
(PROCLAIM proclamation :LOCALLY T)
In a file, this would put the PROCLAMATION into effect for the entire
rest of time during which the file was being loaded (including
recursive loads).
Interactively, it would be the same as :LOCALLY NIL.
(PROCLAIM proclamation :LOCALLY NIL)
In a file or interactively, this would put the PROCLAMATION into
effect permanently. (The declaration would not be retracted when the
file was done loading.)
Proposal (PROCLAIM-SCOPE:ADD-KEYWORD-NON-PERVASIVE):
Introduce a :LOCALLY keyword parameter to PROCLAIM which controls
the scope of a proclamation.
(PROCLAIM proclamation :LOCALLY T)
In a file, this would put the PROCLAMATION into effect for the entire
rest of the current file. Recursive loads or compilations would rebind
this to the global default.
Interactively, this would affect interactive work but would not
affect the default for files loaded.
(PROCLAIM proclamation :LOCALLY NIL)
In a file or interactively, this would put the PROCLAMATION into
effect permanently, affecting the default for files in which no
local proclamation overrode it. (The declaration would not be retracted
when the file was done loading.)
Test Case:
Given a file "FOO" containing:
(PROCLAIM '(OPTIMIZE (SPEED 0) (SAFETY 3)) :LOCALLY T)
...
Doing
(LOAD "FOO")
would not clobber the global default for SPEED/SAFETY.
Rationale:
This would address several existing problems with CL...
- Declarations of optimize qualities such as speed/safety
- Absence of UNSPECIAL declaration
Macsyma has a lot of files which do (PROCLAIM '(SPECIAL ...)) at the
top of the file and then does an implementation-specific
(PROCLAIM '(UNSPECIAL ...)) at the bottom for implementations that
support it. It would be both more modular and more portable to do
something such as what is proposed here.
Current Practice:
Symbolics Cloe binds optimization qualities (SAFETY, SPEED,
COMPILATION-SPEED) in file compilations and doesn't allow
them to affect the global default.
Cost to Implementors:
[I imagine the level of difficulty in providing this feature is in the
low to intermediate difficulty range. It's not likely to be trivial for
anyone, but I doubt anyone is going to claim that it is prohibitively
expensive if we can get the details right and show that it satisfies a
real need. -kmp]
Cost to Users:
None. This is a compatible change.
Cost of Non-Adoption:
Programmers would continue to clobber each others environments with pervasive
SPEED and SAFETY proclamations.
Benefits:
It would be possible to proclaim SPEED/SAFETY information locally in a file
without worrying about the pervasive effect on other code compiled/loaded
subsequently in the same environment.
Aesthetics:
Probably people would find that this kind of flexibility had a beneficial
effect on program aesthetics.
Discussion:
Pitman has no firm opinion on this issue at this time, but believes that
something like this might be quite useful if we could iron out the details.