However, the structure of local
variables also contain a type structure that must remain consistent in any new variables that the function
is assigned to.
Chapter 4: Controlling the Flow of Information
91
Local Function Type Structure
When declaring a variable to contain a local function, the type of that variable can be assigned through
type inference, or the type can be assigned at design time. Typing a variable for local functions follows a
very functional language approach where alerting the compiler that a function is expected is not enough.
Instead, each of the parameter types, and the function ??™ s return type, must be specified so that any
exchange of function reference assigned to the variable will at least expect the same data type input
and output.
A variable expecting a local function must be typed in the following fashion:
var functionVariable : ParamOne [[- > ParamTwo] ...]- > ReturnValue;
Here, each of the function ??™ s parameter types are provided and separated with an - > operator, then, as
functions can only return one value, that type is appended to the end and separated with yet another - >
operator.
Pages:
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212