Forward Declaration and Static References in Mynx
Mynx uses forward declaration within unit scope -- anything declared in unit scope (i.e. attributes or methods) is global within the scope, hence the rule within a method of declaration before use semantics is inapplicable.
Implementation as previously discussed does not require multiple compiler passes, or language design of declaration before use semantics. Using a multi map, every undeclared identifier encountered is tracked, and can be resolved on the fly as declarations are processed.
In case by case examples, the case of implicit static references emerges as a possible usage case in Mynx source code text for implicit forward declaration context semantics.
At the end of processing the class, the variable identifiers: IO, eoln do not have a corresponding declaration in the unit or class context.
There is a natural fit with implicit static methods, not by intention or design, but by properties or effect.
As a programming language designer, often things are forced together (sorta like taking the stickers off a Rubik’s cube so it is “solved”) to put distinct features together in a common foundation. Java or C#’s primitives with references (autoboxing to connect the features from C# to Java); C++ has union, struct, and class; C# struct, class, interface; Java has simplified somewhat to class and interface.
When features are naturally joined, it indicates a good language design by its effect. A language with many features that are not well joined or need other features to connect them is not as well designed. Implicit static having a natural resolution with forward declarations in a multi-map is a case in point with Mynx.
Implementation as previously discussed does not require multiple compiler passes, or language design of declaration before use semantics. Using a multi map, every undeclared identifier encountered is tracked, and can be resolved on the fly as declarations are processed.
In case by case examples, the case of implicit static references emerges as a possible usage case in Mynx source code text for implicit forward declaration context semantics.
with mynx.io.IOStream; //absolute inclusion of class
//implicit static reference
class ImplicitForward is
public theMethod is
var Int x to 0;
IO <<< x <<< eoln; //IOStream.IO <<< x <<< IOStream.eoln;
end theMethod;
end class;
At the end of processing the class, the variable identifiers: IO, eoln do not have a corresponding declaration in the unit or class context.
There is a natural fit with implicit static methods, not by intention or design, but by properties or effect.
As a programming language designer, often things are forced together (sorta like taking the stickers off a Rubik’s cube so it is “solved”) to put distinct features together in a common foundation. Java or C#’s primitives with references (autoboxing to connect the features from C# to Java); C++ has union, struct, and class; C# struct, class, interface; Java has simplified somewhat to class and interface.
When features are naturally joined, it indicates a good language design by its effect. A language with many features that are not well joined or need other features to connect them is not as well designed. Implicit static having a natural resolution with forward declarations in a multi-map is a case in point with Mynx.
Labels: mynx, Mynx rationale, mynx semantic

<< Home