[Ecls-list] with-accessors && declare

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Wed Apr 7 18:46:45 UTC 2010

On Tue, Apr 6, 2010 at 6:08 AM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:

> BTW, I noticed something else when doing these tests: If using
> COMPILE-FILE on a file including OPTIMIZE DECLAIM form at the top, this
> appears to be ignored.  If loading such a DECLAIM form with LOAD, or if
> typing it at the REPL, then it is observed.  Is this expected?

No. DECLAIM should take effect immediately in a compiled file, but only when
it appears as a toplevel form. So, if you have a line

(LET (...) (DECLAIM ...)))

this will be skipped by the compiler. I have verified that DECLAIM does
work. Using a simple file, foo.lsp

(declaim (optimize (safety 3) (debug 3)))

(defun foo (a)
 (cos a))

the following session shows that the debug settings are properly used

> (load (compile-file "foo"))

;;; Loading "/Users/jjgarcia/build/ecl/foo.fas"
> (foo 'a)

In function COS, the value of the only argument is
which is not of the expected type NUMBER

Available restarts:

1. (RESTART-TOPLEVEL) Go back to Top-Level REPL.

Broken at COS.
>> :b

  > COS
  > foo
  > si:bytecodes [Evaluation of: (foo 'a)]

>> :p

Broken at FOO.
 File: "foo.lsp" (Position #41)
>> :v

Local variables:
 A: A
Special variables: none

But it may well be that the problem is with some specific declaim arguments.


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100407/b75feefd/attachment.html>

More information about the ecl-devel mailing list