Movatterモバイル変換


[0]ホーム

URL:


[LISPWORKS][Common Lisp HyperSpec (TM)][Previous][Up][Next]


FunctionCOMPILE

Syntax:

compilename&optional definition =>function, warnings-p, failure-p

Arguments and Values:

name---afunction name, ornil.

definition---alambda expression or afunction. The default is the function definition ofname if it names afunction, or themacro function ofname if it names amacro. The consequences are undefined if nodefinition is supplied when thename isnil.

function---thefunction-name, or acompiled function.

warnings-p---ageneralized boolean.

failure-p---ageneralized boolean.

Description:

Compiles aninterpreted function.

compile produces acompiled function fromdefinition. If thedefinition is alambda expression, it is coerced to afunction. If thedefinition is already acompiled function,compile either produces that function itself (i.e., is an identity operation) or an equivalent function.

If thename isnil, the resultingcompiled function is returned directly as theprimary value. If anon-nilname is given, then the resultingcompiled function replaces the existingfunction definition ofname and thename is returned as theprimary value; ifname is asymbol that names amacro, itsmacro function is updated and thename is returned as theprimary value.

Literalobjects appearing in code processed by thecompile function are neither copied norcoalesced. The code resulting from the execution ofcompile referencesobjects that areeql to the correspondingobjects in the source code.

compile is permitted, but not required, toestablish ahandler forconditions oftypeerror. For example, thehandler might issue a warning and restart compilation from someimplementation-dependent point in order to let the compilation proceed without manual intervention.

Thesecondary value,warnings-p, isfalse if noconditions oftypeerror orwarning were detected by the compiler, andtrue otherwise.

Thetertiary value,failure-p, isfalse if noconditions oftypeerror orwarning (other thanstyle-warning) were detected by the compiler, andtrue otherwise.

Examples:

 (defun foo () "bar") =>  FOO (compiled-function-p #'foo) =>implementation-dependent (compile 'foo) =>  FOO  (compiled-function-p #'foo) =>true (setf (symbol-function 'foo)       (compile nil '(lambda () "replaced"))) =>  #<Compiled-Function> (foo) =>  "replaced"

Affected By:

*error-output*,*macroexpand-hook*.

The presence of macro definitions and proclamations.

Exceptional Situations:

The consequences are undefined if thelexical environment surrounding thefunction to be compiled contains anybindings other than those formacros,symbol macros, ordeclarations.

For information about errors detected during the compilation process, seeSection 3.2.5 (Exceptional Situations in the Compiler).

See Also:

compile-file

Notes: None.


The followingX3J13 cleanup issues,not part of the specification, apply to this section:


[Starting Points][Contents][Index][Symbols][Glossary][Issues]
Copyright 1996-2005, LispWorks Ltd. All rights reserved.


[8]ページ先頭

©2009-2025 Movatter.jp