Caché ObjectScript

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Caché ObjectScript
Appeared in 1997
Influenced by MUMPS
OS Cross-platform

Caché ObjectScript (COS) is a part of the Caché database system sold by InterSystems. The language is a functional superset of the ANSI-standard M (i.e. MUMPS) programming language. MUMPS programmers can run existing MUMPS routines under Caché with little or no change. As an extension, COS includes all of M's unique features, including the built-in database, sparse arrays, a single datatype, run-time scoping of variables, and the powerful text manipulation functions. In addition, COS offers a number of additional features, including integrated support for object-oriented programming, a macro preprocessing language, embedded SQL for ANSI-standard SQL access to M's built-in database, procedure and control blocks using { } syntax, procedure-scoped variables, and relaxed whitespace syntax limitations.

The language has private and public variables and globals. Global has a different meaning in this language than in most; it does not refer only to scope but also to permanence. Globals refer directly to items stored in the hierarchical database. Any global that is SET will retain its value across system shutdowns. Also, all globals have universal scope.

The scope of a private variable is the local function, the scope of a public variable is the entire process. Variables, private and public, may be single elements or complete multi-dimensional arrays.

An interesting characteristic of hierarchical databases is that the data is always sorted (basically the data structure is a B-tree). There are no sorting functions in the language itself. To sort data in a different order, you create a new array with different indices and copy the original array to the new one.

All arrays are "sparse". Space is only allocated for nodes that contain values. The arrays are multi-dimensional, but it is easiest to think of them as tree structures, not as linear or rectangular storage.

The original scripting language for Caché, Caché ObjectScript is an object-oriented language. One interesting feature of Caché ObjectScript is that it enables the intermixing of data access methods – developers may view data as objects, as relational tables (using SQL), or as multidimensional arrays. Also, unlike some other object languages, Caché ObjectScript allows stand-alone routines. It does not require that all code be part of some object class method. To really know Caché ObjectScript you will need to learn about the former name of the language (or Intersystems implementation), which is MUMPS.

See also[edit]

External links[edit]