Go to the first, previous, next, last section, table of contents.


Understanding Exported Symbols

When you do

13 --> *count*

you create a symbol named *count* in the current package (assuming no such symbol previously existed) and put 13 in its value slot. (It is good Muq programming style to put asterisks around the name of a global variable.)

When you do

: thirteen 13 ;

you create a symbol named thirteen in the current package and put :: 13; in its function slot.

When you do

'abc

you create a symbol named abc in the current package.

In all of these cases (and more), the symbols created are entered in the hidden area of the current package, and are considered private to that package. (They can be accessed from other packages by using the package-name::symbolName syntax, but this is intended as a hack for debugging and such, not as something which should be done as a part of normal use of the package.)

Use the export function to make a symbol (and hence any value, function, or property list associated with it) publicly available in the package:

'*count*  export
'thirteen export
'abc      export

This enters the given symbol into the public area of the current package, making it accessable (for example) via package-name:symbolName notation.

You may use lxf (List eXported Functions) to list exported symbols in the current package which have their function slot set; You may use lxv (List eXported Variables) to list exported symbols in the the current package which have their value slot set.

If you export a symbol by mistake, you may undo the effect using unexport. See section `unexport' in Muf Reference.

It is good programming practice to group all the export statements in a source file together, often right after the inPackage line, and accompanied by comments explaining the intended use of the exported symbol. These comments may often be all the user of a package needs to know about it.


Go to the first, previous, next, last section, table of contents.