It is currently Wed Nov 13, 2019 2:14 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Allow UseModule to export inherited idententifiers
PostPosted: Tue Oct 01, 2019 2:26 am 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3358
Allow UseModule in DeclareModule to export inherited identifiers.

For example:

Code:
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:

Quote:
Constant not found: #Triangle.


To work around this we have to do this:

Code:
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye