Caché ObjectScript

Caché ObjectScript
First appeared1997
OSCross-platform
Influenced by
MUMPS

Caché ObjectScript is a part of the Caché database system sold by InterSystems. The language is a functional superset of the ANSI-standard MUMPS programming language. Since Caché is at its core a MUMPS implementation, it can run ANSI MUMPS routines with no change. To appeal as a commercial product, Caché implements 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 C-like brace 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; such variables are global across routines, processes, and sessions. Thus, editing a global variable is making permanent and immediate changes to a system-universal database (which survives reboots, etc.). 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.

The great majority of Caché's feature-set is inherited from the ANSI MUMPS standard. See that article for details on how data is represented and the different ways a programmer can think about the data during development.

Caché programming examples

Hello world program as a routine

hello // hello world routine
    write "hello world"
end quit  // end

Then in Caché Terminal (assuming you wrote the hello routine to the SAMPLE namespace):

SAMPLE> DO ^hello

[1]

Hello world program as a ClassMethod

Class User.Helloworld
{
  ClassMethod HelloWorld()
  {
    // Write to console
    Write "Hello World"
    Quit
  }
}

Then in Caché Terminal (assuming you wrote the User.Helloworld Class to the SAMPLE namespace):

SAMPLE> DO ##class(User.Helloworld).HelloWorld()

See also

References

  1. ^ "Quit Command | ObjectScript Tutorial | Caché & Ensemble 2018.1.4 & 2018.1.5".


Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.