next up previous contents
Next: A Guide to Debugging Up: System Commands Previous: Internal Variables

   
Options

The option command in Darwin flags procedure as being special is some way. Any such declarations must be placed immediately following any local and global variable declarations and preceding a description command.

> example := proc( )
>   global a, b, c;
>   local x, y, z;
>   option polymorphic;
>   description 'This procedure serves only as an example.';
  
    (body of procedure)

> end:

Chapter [*] shows how the option polymorphic command allows one to overload on the name of the routine. Section [*] describes how routines can automatically handle vector operations!!!. Section [*] describes how option numeric can speed up purely mathematical functions and Section [*] introduces the option trace command for aiding in the process of debugging. The remaining option we have yet not seen is the option builtin command. This command is used to indicate to Darwin that the routine is a built-in routine, that is, it is located in the Darwin kernel. If you examine the file named darwinit located in the Darwin library, you will see the declaration and description line for every routine in Darwin. Some listed routines also contain the command option builtin. When a user invokes a routine, Darwin looks for that name in this list. If it finds it and it is accompanied by the option builtin command, it knows that this function has not been coded in Darwin. Users of Darwin can not add new built-in routines as this would require a re-compilation of the Darwin kernel.



Table: The option command.
1.1 
Table: The option command.
Name Description
builtin Indicates that the routine is located in the kernel.
numeric Can be used to optimize routines which only perform
  numeric operations.
polymorphic Allows the name of the routine to be overloaded (§ [*]).
trace Directs Darwin to display the value of parameters,
  the result of every executed statement, and the return
  value of the procedure
zippable Allows the routine to operate on either numeric
  values or vectors.
 




next up previous contents
Next: A Guide to Debugging Up: System Commands Previous: Internal Variables
Gaston Gonnet
1998-09-15