Intro
Prior to V40.14 language gmBasic used the MigrationSupport conventions for stubbing the language runtime support (RTS) framework. MigrationSupport conventions had the following features:
- The namespaces of the language runtime support stub framework are hard-coded into the system and included MigrationSupport, MigrationSupportUI, and VB6Controls.
- Extension method stubs are placed in the MigrationSupport.SystemExtensions class.
- Stub framework references are identified by scanning the generated code for the string "MigrationSupport" and also scanning the operation streams for references to status="extension" operations.
- MigrationSupport conventions are deprecated.
Beginning with gmBasic V40.14, gmBasic system uses the gmRTL conventions for stubbing the language runtime support framework. gmRTL conventions have the following features:
- The namespaces of the language runtime support stub framework are driven by the metalang files. The default RTS namespaces include gmRTL.Core, gmRTL.GUI, and gmRTL.ASP.
- Extension method stubs may be placed in any namespace. The stubs for status=extensions extension methods are placed in the namespace specified by the Select.ExtensionMethods select. By default this is set in VB7Lang.xml <Select ExtensionMethods="gmRTL.Core" />
- The gmRTL framework has more classes than MigrationSupport framework providing a more descriptive structure for organizing the framework members.
- Stub framework references are identified by details in the metalang and by scanning the generated code scanning the operation streams for references to RTS namespaces.
- gmRTL conventions should be used for all new projects.
Note: stubs for references to COM APIs are handled differently from stubs for references to language operations. COM stub declarations are driven by COM IDFs and based on scanning operation streams for references to COM API elements.
Impact
Implementing the gmRTL conventions required numerous changes to the metalang and the gmBasic logic. The resulting RTS stubbing process is more precise, faster, and flexible. Furthermore, gmRTL translations look very different from MigrationSupport translations, the changes are refactoring: mainly changing the classes holding the RTS members. Although the organization and structure of the RTL stub framework changes, the locations of RTS references in generated code is the same.
Backward compatibility
Although the internal implementation and default metalang for gmRTL is quite different, it should be possible to reproduce MigrationSupport-style translations with custom migration rules. This article describes how this may be done, mainly as a demonstration of the expressive power of the gmStudio toolset, but also as an option for teams who wish to use the new tools/metalang to complete a project already in progress using the deprecated