Procedures, parameters, variables, micros, macros, and structures are declared using simple names. The first character is a letter that may be followed by alphanumeric characters or '.', '_', or '#'. A trailing underscore is not allowed.
Name := Alpha [{Alpha | Digit | '.' | '#'| '_' }* {Alpha | Digit | '.' | '#'}] Alpha := 'a' to 'z' | 'A' to 'Z' Digit := '0' to '9'
Structure fields are referenced using a tick ('`') character between the variable and one or more fields.
Variable`Field Variable`Field`Subfield
The first parameter in a procedure is called the Subject of the procedure. It can be referenced by it's name or by using a dollar sign for short.
Parameter $ $Field $Field`Subfield
Shadow variables are implicitly declared Locals that are initialized upon entry into a Method or Function. They are set to the value of an Entry or Change parameter. You can reference them as the name of the parameter followed by a dollar sign. When you use a shadow variable a Local variable is automatically declared and initialized to the corresponding input value.
method DO.SOMTHING change Subject word local Value word Value = $; Set Value to the Subject. Subject = 4; Set the subject to 4. trace Subject$; Subject$ is the original input Value of Subject. Subject$ = 10; Subject$ is set to 10 and the original value is lost. trace Subject$; The Local, Subject$, now contaions 10. return
Shadow variables are initialized after any preconditions. Consequently you cannot use Shadows in Preconditions or in Trace commands at the beginning of a method body. Also, array parameters cannot have Shadows.
You can abbreviate the Shadow of the procedure subject as: $$
Fields of Shadows are referenced as: Variable$Field
Additional fields use the tick notation: Variable$Field`Subfield
When using a Shadow of a field in a structure the entire structure is declared; not just a shadow of the field. So for the reference "$$Field" a Shadow variable for the subject is declared and initialized to the subject.
Variable, Class, and Method names generally should not be one of the intrinsic Gilda command names. However as long as there is no ambiguity you can use the same name as a keyword. Command keywords in Gilda are:
Alter Clean Else Idiom Method Sequence Assert Class End If Open Trace Catch Close Entry Import Postcondition Undo Change Context Exit Input Precondition Use Churn Do Function Local Print Yield Class Drain Global Map Return
Note that the Open, Close, Clean and Drain commands are designed so they can be overloaded. Users can write generic methods whose names match the keywords. Clean and Drain methods are automatically invoked when initializing and freeing resources and dynamic types.