Go to Deriscope's documentation start page

local_function

In Deriscope terminology, a local function is a special type of function that is similar to the non-static member functions in object oriented programming languages, such as C++.
Like any function it is defined within the scope of a certain
Deriscope Type, but it has the additional feature that it must be invoked by a specific Deriscope Object of that Deriscope Type.

In the spreadsheet a local function named MyFunction defined within a Deriscope Type named MyType and invoked by an Deriscope Object identified through the
handle name named MyHandle may be called using either the full syntax:

ds("OBJECT=","MyHandle","FUNCTION=","MyFunction",...)

or the short syntax:

ds(("MyHandle::MyFunction",...)

, where ... stand for any additional arguments that carry the input - if any - required by MyFunction.

For convenience, a local function may be also called as if it were a
static function, thus calling it using the name of the Deriscope Type in which that function is defined, but passing the still required object as an extra argument through a specialized key named THIS.

The following example demonstrates the above concepts:

The function
Bond::Get Maturity is a local function defined within the Deriscope Type Bond that takes no input arguments and returns the maturity date of the invoking Bond Deriscope Object.
Provided the invoking bond Deriscope Object is referred in spreadsheet through the handle name named MyHandle, the local function can be accessed in the spreadsheet using the full syntax:

ds("OBJECT=","MyHandle","FUNCTION=","Get Maturity")

or the short syntax:

ds(("MyHandle::Get Maturity")

The alternative static short syntax version will look like:

ds(("MyType::MyFunction","THIS=","MyHandle")