Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

setFnWriteProtect

setFnWriteProtect( 
s_name 
) 
=> t / nil

Description

Prevents a named function from being redefined.

If s_name has a function value, it can no longer be changed. If it does not have a function value but does have an autoload property, the autoload is still allowed. This is treated as a special case so that all the desired functions can be write-protected first and autoloaded as needed.

Arguments

s_name

Name of the function.

Value Returned

t

The function is now write protected.

nil

If the function is already write protected.

Examples

Define a function and set its write protection so it cannot be redefined.

procedure( test() println( "Called function test" ))
setFnWriteProtect( 'test ) => t
procedure( test() println( "Redefine function test" ))
*Error* def: function name already in use and cannot be 
redefined - test
setFnWriteProtect( 'plus ) => nil

Returns nil because the plus function is already write protected.

Related Topics

Function and Program Structure


Return to top
 ⠀
X