Scheme
One of the languages used for scripting is Scheme. For an introduction to Scheme, see An Introduction to Scheme.
You can also generate a Scheme Reference by using the Generate NexJDoc tool in NexJ Studio.
Content Assist for Scheme
Scheme Content Assist allows developers to view the list of available variables and functions that can be invoked within a given context. To trigger Content Assist, press Ctrl+Space while the scripting pane is in focus or type the name of the variable followed by an apostrophe, for example this'
.
By default, Content Assist displays the list of available variables and globally defined functions. For example, within a UI Action definition there are special variables like source, name, and parameter, which are defined within that context. In class definitions, the "this" variable is defined within any event or attribute definition.
Content Assist also attempts to list the available member variables of an object if its type can be detected.
For example, if a variable is the result of a read on the Entity
class, then it is considered an Entity type.
(define person (read-instance Entity '() '(= (@ lastName) "Lamont") '()))
Typing person'
automatically triggers Content Assist, which lists the available attributes and events that can be invoked on an Entity.
When defining a function, the arguments and return types can be declared in the function comments. The general form for declaring argument and return types is:
; @arg <argument name> <argument type> <description of argument>
; @ret <return type> <description of the returned object>
The following example shows the declaration of argument type for entity
and return type for the function.
; @arg entity Person A person to perform an operation on
; @ret Telcom The default telcom of the person
(define (getTelcom entity)
(logger'info (entity'firstName))
;return
(entity'defaultTelcom)
)
In this case, typing entity'
within the scope of the function definition triggers Content Assist for the entity
variable. Since entity
is declared as a Person type using the @arg
tag, Content Assist lists the available attributes and events for the Person
class.
If you assign the result of the above function to a variable, that variable is assumed to take on the type declared in the @ret
tag.
(define telcom (getTelcom timLamont))
In this case, typing telcom'
lists attributes and events declared in the Telcom
class, because of the @ret
tag used in the getTelcom
definition.