overload (--)overload creates a pending overload specifier in the current scope.
That pending specifier is consumed by the next successful local creation. Intervening operations do not consume it.
A public overload can be selected directly by module loading. A private overload participates in same-name lookup only after its module has already been loaded through some other public name.
overload again is invalid.importVariable.private or virtual coexist with the pending overload specifier.overloadExample.mpl
private overload virtual hiddenHelper: 3;
overload virtual helper: 1;
virtual publicAgain: 2;
test.mpl is the primary runnable example file. indirectLookupExample.mpl records the separate lookup case after module loading through another public name.
test.mpl
"overloadExample.helper" use
{} 0 {} [
"-- directly selected public overload --" printCompilerMessage
helper printStack _:;
0
] "main" exportFunction
indirectLookupExample.mpl
"overloadExample.publicAgain" use
{} 0 {} [
"-- following created name is public --" printCompilerMessage
publicAgain printStack _:;
"-- public overload still participates in lookup --" printCompilerMessage
helper printStack _:;
"-- private overload also participates after module load --" printCompilerMessage
hiddenHelper printStack _:;
0
] "main" exportFunction
Module-loading wrapper lines are omitted below.
-- directly selected public overload --
1
-- following created name is public --
2
-- public overload still participates in lookup --
1
-- private overload also participates after module load --
3
NAME: ...; node — Pushes a name onto the name stack and creates a local by consuming that name and one data-stack value.def builtin (value name --) Creates a named local or field using a known Text name.exportFunction builtin (inputsSchema output options callable name --) Exports a named function built from a Block and a signature; pending overload applies there.importFunction builtin (inputsSchema output options name --) Declares or imports a named function with the supplied signature; pending overload applies there.importVariable builtin (schema name --) Creates a local that refers to external variable storage; pending overload is invalid there.private builtin (--) Marks the next local created by NAME: ...; or def as non-public, so use does not import that name from the module.virtual builtin (--) Marks the next local created by NAME: ...; or def as static; virtual is the historical name for this declaration modifier.