private

private (--)

Inputs

Outputs

private creates a pending visibility specifier in the current scope.

That pending specifier is consumed by the next successful local creation. Intervening operations do not consume it.

A private name remains available for lookup inside its defining module, but it is not directly imported into another module.

Behavior

Example

privateExample.mpl

private hidden: 1;
private overload virtual hiddenHelper: 3;
virtual visible: 2;
showHidden: [
  "-- private name remains usable inside the module --" printCompilerMessage
  hidden printStack _:;
];

test.mpl is the primary runnable example file.

test.mpl

"privateExample.visible" use
"privateExample.showHidden" use

{} 0 {} [
  showHidden
  "-- following created name is public again --" printCompilerMessage
  visible printStack _:;
  "-- private overload still participates after module load --" printCompilerMessage
  hiddenHelper printStack _:;
  0
] "main" exportFunction

Module-loading wrapper lines are omitted below.

Expected Output During Compilation

-- private name remains usable inside the module --
Int32 Cref
-- following created name is public again --
2
-- private overload still participates after module load --
3

See also