FunctionDef:
Filter:
Classes | Core > Kernel

FunctionDef : Object

FunctionDefs contain code which can be executed from a Function.
Source: Kernel.sc
Subclasses: Method

Description

Related Keywords

thisFunctionDef

The global pseudo-variable thisFunctionDef always evaluates to the current enclosing FunctionDef.

See also: thisFunction

Class Methods

Inherited class methods

Instance Methods

Accessing

Even though it is possible to change the values in the various arrays that define the FunctionDef, you should not do it, unless you like to crash.

.code

Get the byte code array.

.sourceCode

Get the source code string.

.context

Get the enclosing FunctionDef or Method.

.findReferences(aSymbol, references)

return a list of all references to a given symbol.

.argNames

Get the Array of Symbols of the argument names.

.prototypeFrame

Get the array of default values for argument and temporary variables.

.varNames

Get the Array of Symbols of the local variable names.

.argumentString(withDefaultValues: true, withEllipsis: false, asArray: false)

Return a string that contains all argument names and their default values for embedding in a string. If there are no arguments, it returns nil.

Arguments:

withDefaultValues

If set to false, no default values are appended

withEllipsis

If set to true, ellipsis characters (" ... ") are appended

asArray

If set to true, return the string for an array that represents all arguments. The other arguments are set to false.

.makeEnvirFromArgs

Get the Array of Symbols of the local variable names.

Generating Strings

.makeFuncArgModifierString: METHOD NOT FOUND!

Return a string that can be interpreted as code for a new function which extracts the arguments from the receiver. This can be used to build a hygienic macro which returns a function with valid keyword arguments, instead of just anonymously forwarding the arguments, like in { |...args| func.valueArray(args) }.

For an implementation example Function: flop (as below).

Arguments:

modifier

A function to which a string is passed that represents the array of all arguments. It should return a string that can be interpreted.

Utilities

.dumpByteCodes

"Disassemble" and post the FunctionDef's byte code instructions to the text window.

Inherited instance methods

Undocumented instance methods

.archiveAsCompileString

.asFunction

.checkCanArchive

.constants

.dumpContexts

.hasPartialApplication

.inspectorClass

.keyValuePairsFromArgs

.makeFuncModifierString(modifier)

.numArgs

.numVars

.selectors

.shallowCopy

.varArgs