[Ecls-list] Arglist?
Pascal J. Bourguignon
pjb at informatimago.com
Thu Feb 11 23:56:10 UTC 2010
On 2010/02/11, at 23:04 , szergling wrote:
> On 2/8/10, Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com
> > wrote:
>> ECL does not normally store information about a compiled function
>> lambda
>> list, just for economy reasons -- it is not used anywhere in ECL,
>> not even
>> in the debugger because function arguments are directly registered
>> by the
>> function at run time if debug settings are large enough.
>>
>> If such a function is really needed we would have to add an option
>> to the
>> compiler so that it stores the lambda list or even the function
>> code, though
>> the latter would be questionable, given the bloat that would
>> result. In any
>> case it would not be that difficult.
>
> Not sure if you all know about this, but clisp does it through
> the declaration mechanism:
>
> http://clisp.cons.org/impnotes/declarations.html#space-decl
>
> I'm not sure if this is better than a dynamic variable, which seems
> more versatile to me, though that's probably because of CL's
> lack of native support for the convenient use (eg temporary
> change to optimization levels) of compilation settings.
Declarations are explicitely extensible in CL, thanks to the
declaration declaration.
I agree that it would be nice to link keeping meta information to the
SPACE declaration. However, if finer declarations are needed, they
can easily be added.
Eg. assuming:
(<=> speed-opt-case-as-table (and (< 0 speed) (< space 3)))
(<=> space-keep-arglist (< space 3))
we could, if we wanted both the hightest speed optmizations and the
arglist, declaim:
(declaim (optimize (speed 3)
(space 3)
(ext:space-keep-arglist)))
so we optimize for speed an space, (therefore not have the case-as-
table speed optimization), but we keep the argument lists.
Also, the advantage of declarations over global special variables
is that you can specify them easily per object:
(defun %f (a b c)
(declare (optimize (ext:space-no-keep-arglist))) ; don't keep the
arglist of
...) ; internal
function whatever
; the space
optimization.
(defun normal-function (a b c)
;; will keep or not the arglist depending on global optimize space.
...)
(defun external-function (a b c)
(declare (optimize (ext:space-keep-arglist))) ; keep the arglist
of
...) ; public functions
whatever
; the space
optimization.
(Assuming ecl declaimed somewhere:
(declaim (declaration ext:space-no-keep-arglist ext:space-keep-
arglist ...))
A file containing this declaim could be provided for inclusion in
portable programs.
).
--
__Pascal Bourguignon__
http://www.informatimago.com
More information about the ecl-devel
mailing list