Re: ANSI question (load evaluation order)



Nicolas Neuss <my.name@xxxxxxxxxxxxxxxxxxxxx> writes:

> Hello,
>
> should the following work or do I have to wrap the function definition in
> an (EVAL-WHEN (:LOAD-TOPLEVEL)...)?
>
> test.lisp:
>
> (in-package :cl-user)
>
> (defun test ()
> "Doc"
> nil)
>
> (assert (documentation 'test 'function))
>
>
> In REPL:
> (load (compile-file "test"))
>
> It works in CMUCL/SBCL, but not in ACL.

CLHS says clearly that:

defun is not required to perform any compile-time side effects. In
particular, defun does not make the function definition available at
compile time. An implementation may choose to store information about
the function for the purposes of compile-time error-checking (such as
checking the number of arguments on calls), or to enable the function
to be expanded inline.


--
__Pascal Bourguignon__ http://www.informatimago.com/
Grace personified,
I leap into the window.
I meant to do that.
.



Relevant Pages

  • Re: Q: logging in realtime
    ... > trace code must not be present in function definition. ... still a nice thing to be able to remove logging compile-time if you ... "Den som kun tar spøk for spøk og alvor kun alvorligt, ...
    (comp.lang.lisp)
  • Re: [PHP] Structured Code vs. Performance
    ... In my mind Zend Studio would not let me step through a compile-time process, but it's looking likely that that's precisely what it's doing if I'm to believe everything I'm reading. ... If there is a function definition contained within the file, or a function defined within a function, the debugger does not hit that definition unless the condition matches or the function is called. ... To me this indicates that PHP defines entities at run time. ...
    (php.general)
  • Re: How do interior functions differ from flet?
    ... DEFUN creates a global function definition. ... Compare: ... Furthermore, unlike nested DEFUNs, the FLET form in G need not be "executed" each time G is invoked. ...
    (comp.lang.lisp)
  • Re: ANSI question (load evaluation order)
    ... Christophe Rhodes writes: ... >> should the following work or do I have to wrap the function definition in ... as they are free to discard documentation strings ...
    (comp.lang.lisp)
  • Re: ANSI question (load evaluation order)
    ... Nicolas Neuss writes: ... > should the following work or do I have to wrap the function definition in ... as they are free to discard documentation strings ...
    (comp.lang.lisp)