Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Next section

Specifying Method Keywords

Specifying Method Keywords

In a method definition, you can include optional compiler keywords that affect how the method behaves. The following list shows some of the most commonly seen method keywords:

By default, the variables used in a method are private to that method, because by default all methods are procedure blocks. To define a method as a non-procedure block, specify the ProcedureBlock keyword as 0. For example:

Method MyMethod() [ ProcedureBlock = 0 ] 
    //implementation details
Copy code to clipboard

In this case, the variables in this method would be public variables.

You have the choice of implementation language when creating a server-side method in Caché. The options are basic (Caché Basic), cache (ObjectScript), mvbasic (MVBasic), and tsql (TSQL).

By default, a method uses the language specified by the Language keyword specified for the class. In most cases, that keyword is cache (ObjectScript).

Specifies that the method is private. Subclasses inherit the value of the Private keyword and cannot override it.

By default, methods are public and can be accessed anywhere. You can mark a method as private (via the Private keyword). If you do:

  • It can only be accessed by methods of the class to which it belongs.

  • It does not appear in the InterSystems Class Reference, which is introduced later in “InterSystems Class Reference.”

It is, however, inherited and available in subclasses of the class that defines the method.

Other languages often call such methods protected methods.

FeedbackOpens in a new window