Procedure Options - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Procedures and Functions : options : option

Procedure Options

Calling Sequence

option optseq

options optseq




sequence of symbols or equations



A sequence of options may be provided as part of a module or procedure definition.


The options currently recognized are: arrow, autocompile, builtin, cache, call_external, hfloat, inline, load=memberName, operator, procname, remember, system, threadsafe, trace, unload=memberName, and `Copyright...`.


The special options load= and unload= can be used only in module definitions.  The options arrow, autocompile, builtin, call_external, inline, operator, and remember can be used only in procedure definitions. The option trace can be used in procedure and module definitions.


The autocompile option causes the kernel to attempt to compile the procedure to native code on first execution. If the compilation succeeds, the name by which the procedure was invoked is re-assigned the value of the compiled procedure. In effect, the original procedure is replaced with the procedure that runs the compiled code.


Option builtin is used to identify Maple's built-in functions. For example, the type function is a built-in function in Maple, and the value of eval(type) is:


procoptionbuiltin=type;end proc


The builtin option identifies this as a built-in function, and the name following builtin identifies this particular function.


For a description of the call_external option, see external_calling.


For a description of the hfloat option, see option hfloat.


For a description of the inline option, see in-lining.


For a description of the package, load and unload options, see module[option].


For a description of the overload option, see overload.


Option operator declares to the Maple system that the procedure was entered and is to be printed and otherwise manipulated as an operator. Thus,

f := x -> x^2-1;


is equivalent to

f := proc(x) option operator, arrow; x^2-1 end proc;


Option arrow, in conjunction with option operator, indicates that the operator was initially entered using the -> notation. The use of option arrow also disables Maple simplification rules that add any non-local names in the operator expression to the parameter list. This option has no meaning for modules.


Option procname causes a procedure to inherit the name of the procedure that called it. Any exceptions raised within the called procedure will be reported as having occurred in the calling procedure. This allows encapsulation of error checking code into a sub-procedure, while still producing error messages that appear to originate from the main procedure.


For a description of the remember option, see remember.


For a description of the cache option, see CacheOption.


Option system serves to identify procedures in the Maple library that are considered to be "system functions", meaning functions for which the remember table may be deleted at garbage collection time.  If this option is not specified for a procedure that has the remember option, the remember table survives garbage collections.  This option is not currently used for modules.


Option threadsafe marks a procedure as being thread-safe, that is, safe for use in multithreaded code.  Portions of the kernel may recognize this option and allow the procedure to be called in multiple threads simultaneously.  It is the user's responsibility to ensure that the threadsafe option is only applied to procedures that are, in fact, thread-safe. In addition, the Compiler recognizes the threadsafe option and compiles a procedure with this option to one that can be called simultaneously from multiple threads.


Option trace makes the procedure or module execute as though it were under a sufficiently high value of printlevel as to show the entry and exit calls and all the internal statements. This effect is independent of the value of printlevel, and is confined to the procedure or module that has the option.


Option Copyright is used to add a copyright notice to a procedure or module.  Any option starting with "Copyright" is considered a copyright option.  The Maple expression formatter does not print the body of procedures that has a copyright notice unless the interface variable verboseproc has the value 2 or higher. This is accomplished with the command interface(verboseproc=2). Maple library routines and modules have a copyright option in effect.

See Also

cache, call_external, Compiler, inline, interface, module, Operators, option hfloat, overload, Procedures, remember, trace, type[builtin]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam