Closed zackeryfix closed 8 years ago
This ABI/naming convention should support ALL existing languages including scirpting languages that accept user input dynamically. For instance, we can easily write wrapper constructs to invoke interpreter executables through the OS and pass C++ data structures as arguments to the program for languages that do not have the concept of functions. For the languages that do not have a concept of namespaces, types, code spaces, or scopes, we will simply mimic them as if they did exist. Conceptual RTI in this framework will be a true common language infrastructure.
This will be closed when the next version is cut.
We need to set a standard ABI to use when generating mirrors that point to the various kinds of RTI recognized by the reflection engine. An ABI (or Application Binary Interface) is used to represent symbols within an executable file. This is useless as far as the framework is concerned during the current phase of development, but in later stages the ABI will prove very useful if we define it early on. Well, I wouldn't say that the ABI is useless, because we need it to generate unique mirrors for identifying RTI stored by the framework at compile-time, and referencing the RTI during runtime. I have devised the following rules that are defined strictly by a set of character symbols that are used as markers in the mirror primarily as a means of quickly parsing and identifying the RTI construct that they represent:
- TypeInfo
This may be confusing, but stay with me. These five rules clearly outline the following examples of valid full name ABIs. (Note: these are examples for FULL name ABIs, but in the framework all RTI is store locally within the construct they directly belong to and FULL name ABIs are only used when attempting to access RTI where the directly related construct is unavailable.):
Ngen::Reflection::AssemblyInfo
LIBRARY|ASSEMBLY
Ngen::Reflection::NamespaceInfo
LIBRARY|ASSEMBLY:NAMESPACE:NAMESPACE
namespace { namespace { } }
Ngen::Reflection::TypeInfo
LIBRARY|ASSEMBLY:NAMESPACE#TYPE
namespace { class { }; }
Ngen::Reflection::TemplateTypeInfo
LIBRARY|ASSEMBLY:NAMESPACE#TYPE??
namespace { template<typename T, typename T2> class { }; }
Ngen::Reflection::FieldInfo (nested inside NAMESPACE)
LIBRARY|ASSEMBLY:NAMESPACE@type%FIELD
namespace { _type_ Field; }
Ngen::Reflection::FieldInfo (nested inside nested TYPE)
LIBRARY|ASSEMBLY:NAMESPACE#TYPE#TYPE@type%FIELD
namespace { class { class { _type_ Field; }; }; }
Ngen::Reflection::MethodInfo (nested inside templated TYPE)
LIBRARY|ASSEMBLY:NAMESPACE#TYPE?$type%METHOD(type%PARAM,?%PARAM)
namespace { template<typename T> class { _return_ Method(_type_ param0, T param1) { } }; }
Ngen::Reflection::TemplateMethodInfo (nested inside NAMESPACE)
LIBRARY|ASSEMBLY:NAMESPACE$return%METHOD??(?%PARAM,?%PARAM)
namespace { template<typename T, typename T2> _type_ Method(T param0, T2 param1) { } }; }
Notice in these examples that all trait information is excluded (such as const, public, private, static, etc). This is because most languages (including the C/C++ languages) do not allow for same name members existing inside the same code space. Our ABI will take advantage of this whenever possible, and trait information will be stored in the RTI itself (accessed by the ABI mirror representing it). Additionally, all whitespace characters are filled in by using % character. The reason for removing whitespace is for the executable storage requirements that will be used in the later phases of this project.
These are subject to change as the framework comes into light and unforeseen issues arise that conflict with this definition of the ABI.