| Home Introduction Using Holon Holon Tools Contact
HolonJForth |
Parameters
TypeJava is a strongly typed language and you have to indicate the type of every argument in a function call.
The method main expects an array args of string arguments. This syntax is similar to the Java language, but the return result is included in the stack notation in the usual Forth manner.
A result has no name, only a type. The word (method) is the result name. No universal argument stackJava has local stack frames. When a method is called, the parameters are implemented as local variables in the stack frame of the called method. Thus the method only has access to the arguments that are transferred in the call. The arguments are accessed by the names that are defined in the parameter list.
Only one return valueThe method can deliver one or zero results. DiscussionIn practice these properties are useful and not restrictive. Some Forth words do have more than one return value, e.g. rot . However, HolonJ implements the stack manipulation words as macros, which insert Java byte code inline. We don't have a function call here and thus there is no restriction. If a Java method returns multiple values, it packs the data into an
object. You can do the same in HolonJ. Let's say we return the coordinates
of the central point of a drawing.
|
|
| © 1999-2005 Wolf Wejgaard |