Skip to main content

Class Compilation

You just compiled your class for the first time. In the VS Code Output pane, you saw this:


Compilation started on 01/30/2018 09:51:50 with qualifiers 'cku'
Compiling class ObjectScript.DataEntry1
Compiling routine ObjectScript.DataEntry1.1
Compilation finished successfully in 0.011s.

We briefly discussed routines at the beginning of this tutorial. Since then, the tutorial has focused on writing class methods. Notice that compiling ObjectScript.DataEntry1 caused the compilation of the ObjectScript.DataEntry1.1 routine. Why? Because routines are the lower-level implementation of classes and their methods. This allows older applications written using routines to co-exist with code written using classes. As you can see, the routine name is based on the class name. This can help you understand something you may have noticed in the Terminal example you saw when learning about the Quit command.

Terminal


USER>do ##class(ObjectScript.Examples).BadMethod()

    write c }
    ^
<UNDEFINED>BadMethod+3^ObjectScript.Examples.1 *c
USER 2do>quit

USER>

The error message shows that the <UNDEFINED> occurred in the ObjectScript.Examples.1 routine, on the 3rd line of the BadMethod procedure. The procedure name is based on the class method name, prepended with a "z". This means that to investigate and fix this error, you'd look at the BadMethod() method in ObjectScript.Examples.

FeedbackOpens in a new tab