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 command line interpreter), a table of symbols is saved in the BIM file. If the source is compiled with the strip option (-s), all private symbols are removed from the symbol table — by default all symbols (except parameters) are considered to be private.
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 even when the strip option is in use.
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