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 Dict field cannot be selected by source-text member selection from outside the Dict (.NAME, .@NAME, .!NAME); ordinal access, schema queries and callField still reach it. Private marks take part in the schema of the Dict: two schemas that differ only in the privacy of a field are not same.

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

"privateExample.showHidden" use
"privateExample.visible"    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

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