25.01.2015 Views

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

Using Caché ObjectScript - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Syntax Rules<br />

• The // comment specifies that the remainder of the line is a comment; it can be the first element on the line or follow<br />

other elements.<br />

• The ; comment specifies that the remainder of the line is a comment; it can be the first element on the line or can follow<br />

other elements.<br />

• The ;; comment — a special case of the ; comment type — makes the comment available to the $TEXT function<br />

when the routine is distributed as object code only; the comment is only available to $TEXT if no commands precede<br />

it on the line.<br />

Note:<br />

Because <strong>Caché</strong> retains ;; comments in the object code (the code that is actually interpreted and executed),<br />

there is a performance penalty for including them and they should not appear in loops.<br />

A multiline comment (/* comment */) can be placed between command or function arguments, either before or after<br />

a comma separator. A multiline comment cannot be placed within an argument, or be placed between a command keyword<br />

and its first argument or a function keyword and its opening parenthesis. It can be placed between two commands on the<br />

same line, in which case it functions as the single space needed to separate the commands. You can immediately follow<br />

the end of a multiline comment (*/) with a command on the same line, or follow it with a single line comment on the same<br />

line. The following example shows these insertions of /* comment */ within a line:<br />

WRITE $PIECE("Fred&Ginger"/* WRITE "world" */,"&",2),!<br />

WRITE "hello",/* WRITE "world" */" sailor",!<br />

SET x="Fred"/* WRITE "world" */WRITE x,!<br />

WRITE "hello"/* WRITE "world" */// WRITE " sailor"<br />

2.4.2 Comments in MAC Code for Routines and Methods<br />

All comment types that are valid for INT code are also valid for MAC code and behave in MAC code just as they do in<br />

INT code. Two other comment types are also available:<br />

• The #; comment can start in any column but must be the first element on the line; #: comments do not appear in INT<br />

code.<br />

• The ##; comment can start in any column. It can be the first element on the line or can follow other elements. ##;<br />

comments do not appear in INT code. ##: can be used in <strong>ObjectScript</strong> code or in Embedded SQL code.<br />

• The /// comment can start in any column but must be the first element on the line. If /// starts in column 1, it does<br />

not appear in INT code; if /// starts in column 2 or greater, it appears in INT code and is treated as if it were a //<br />

comment.<br />

2.4.3 Comments in Class Definitions Outside of Method Code<br />

Within class definitions, but outside of method definitions, several comment types are available, all of which can start in<br />

any column:<br />

• The // and /* */ comments are for comments within the class definition.<br />

• The /// comment serves as class reference content for the class or class member that immediately follows it. For<br />

classes themselves, the /// comment preceding the beginning of the class definition provides the description of the<br />

class for the class reference content which is also the value of description keyword for the class). Within classes, all<br />

/// comments immediately preceding a member (either from the beginning of the class definition or after the previous<br />

member) provide the class reference content for that member, where multiple lines of content are treated as a single<br />

block of HTML. For more information on the rules for /// comments and the class reference, see either “Extending<br />

the Class Reference” in <strong>Using</strong> <strong>InterSystems</strong> <strong>Documentation</strong> or the %CSP.Documatic entry in the <strong>InterSystems</strong> Class<br />

Reference.<br />

10 <strong>Using</strong> <strong>Caché</strong> <strong>ObjectScript</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!