This section describes new programming language features introduced
in this version of Caché.
The Basic Scripting Language
According to some estimates, half of the world's professional developers
are familiar with the Basic programming language. To make it easy for those
developers to be immediately productive with Caché, this release introduces
Basic as an additional scripting language.
Basic is implemented as a native language within the Caché engine;
Basic code is compiled into efficient object code that is completely compatible
with object code generated from Caché ObjectScript. The syntax is essentially
a subset of the functionality provided by the VBScript implementation of Basic.
You can use Basic to implement methods in Caché classes. Within Basic
you can directly access globals and objects, and can interoperate with Caché
ObjectScript.
Basic is supported on every platform supported by Caché.
Defining Methods in Basic
Basic is designed to be used as implementation language for methods
within Caché classes. Caché Studio offers complete support for
Basic including syntax coloring. To create a method using Basic, simply set
the
language keyword for the method
to
basic:
Method MakeString(x As %Integer) As %String [language = basic]
{
txt = ""
For i = 1 To x
txt = txt & i
Next
Return txt
}
You can also set the class-level
language keyword
to
basic to make Basic the default language for all methods
within a class:
Class MyApp.MyClass Extends %RegisteredObject [language = basic]
{
Method MakeString(x As %Integer) As %String
{
txt = ""
For i = 1 To x
txt = txt & i
Next
Return txt
}
}
Caché ObjectScript Language Enhancements
In this release, the Caché ObjectScript Language has the following
enhancements:
-
System-level support for object references including a new
$IsObject function to test if a variable contains
an object reference.
-
A set of new functions for operating on bit strings (see
$Bit). The 3 argument version of
$Bit (bit
set and get), available in earlier Development Kits, is no longer supported.
-
A new
Continue command.
This command skips the rest of the body of a loop and returns to the top for
further execution.