The public qualifier
Once a source file has been compiled, the identifiers used to designate the objects of the model become useless for Mosel. In order to access information after a model has been executed (for instance using the print command of the interractive debugger), a table of symbols is saved in the BIM file.
The qualifier public can be used in declaration and definition of objects to mark those identifiers (including subroutines) that must be published in the table of symbols. Without this qualifier a symbol is considered to be private and it is not recorded in the table of symbols (unless the source is compiled with debugging information).
public declarations e:integer ! e is published f:integer ! f is published end-declarations declarations public a,b,c:integer ! a,b and c are published d:real ! d is private end-declarations forward public procedure myproc(i:integer) ! 'myproc' is published
This qualifier can also be used when declaring record types in order to select the fields of the record that can be accessed from outside of the file making the definitions: this allows to make available only a few fields of a record, hidding what is considered to be internal data.
declarations public t1=record i:integer ! t1.i is private public j:real ! t1.j is public end-record public t2=public record i:integer ! t2.i is public j:real ! t2.j is public end-record end-declarations
Note that a public record type can only contain public types even if it does not publish its fields.