Question: Local/ global/ export variables for modules with submodules

Hello,

I have a quite big program designed with packages and subpackages.

I realized that i'm not to well understand the operation of local/ global/ export variables in this case.

Let's detail the issue.

I consider a package like this :

MAIN PACKAGE:=module()

local XM

global YM

export ZM

      SUBPACKAGE1:=module()

      local X1

      global Y1

      export Z1

      end module;

      SUBPACKAGE2:=module()

      local X2

      global Y2

      export Z2

      end module;

end module;

Question:

Can you describe in the simpliest way the rules for accessing to the variables in the case the variables are local/ global/ export and in the case you are writting procedures inside the MAINPACKAGE or the SUBPACKAGEs ?

In others words may you help me to answer to these questions  ?

Is the local variable XM accessible to the procedures used in SUBPACKAGE1? no
Is the local variable X1 accessible to the procedure used in MAINPACKAGE ? no

Is the global variable YM accessible to the procedures used in SUBPACKAGE1? yes
Is the global variable Y1 accessible to the procedure used in MAINPACKAGE ? yes

Is the export variable ZM accessible to the procedures used in SUBPACKAGE1? yes
Is the export variable Z1 accessible to the procedure used in MAINPACKAGE ? yes with the syntax SUBPACKAGE:-Z1

I let my opinion but i need certainty on these points...

I attach a first draft that i would like you help me.

AboutModuleLocalGlobalExport.mw

I thank you in advance for your help.

Please Wait...