Page 1 of 1

Allow UseModule to export inherited idententifiers

Posted: Tue Oct 01, 2019 2:26 am
by Mistrel
Allow UseModule in DeclareModule to export inherited identifiers.

For example:

Code: Select all

DeclareModule Triangle
  #Triangle=1
EndDeclareModule
Module Triangle
EndModule

DeclareModule Square
  #Square=2
EndDeclareModule
Module Square
EndModule

DeclareModule Pentagon
  #Pentagon=3
EndDeclareModule
Module Pentagon
EndModule

DeclareModule Shapes
  UseModule Triangle
  UseModule Square
  UseModule Pentagon
EndDeclareModule
Module Shapes
EndModule

Debug Shapes::#Triangle
This results in the following error:
Constant not found: #Triangle.
To work around this we have to do this:

Code: Select all

DeclareModule Shapes
  #Triangle=Triangle::#Triangle
EndDeclareModule
This duplicates code and is error prone due to tight coupling.

Note that this is scoped in DeclareModule which is public. The same behavior would not occur for UseModule on a Module block which is private.