Page 1 of 1

Module bad understanding

Posted: Sun Apr 16, 2023 6:01 am
by Denis
I don't know if it is a misunderstanding from me or a bug.
Maybe the modules are not as clear to me.
Not a big problem.

The first code show a compiler error :
Debug Essai::String_1$ generate an error but CompilerIf Essai::#Mode_Debug = #True not, inside procedure Start(). But all #Mode_Debug & Global String_1$, Global String_2$, Global String_3$ are declared inside DeclareModule.
If i change Debug Essai::String_1$ for Debug String_1$ (String_2$ et String_3$), it's Ok.

Code: Select all

EnableExplicit

DeclareModule Essai
    
      #Mode_Debug = #False
      
      CompilerIf #Mode_Debug = #True
            Global String_1$ = "Première chaine"
            Global String_2$ = "Seconde chaine"
            Global String_3$ = "Troisième chaine"
      CompilerEndIf
      
      Declare.i Start()
EndDeclareModule

Module Essai
      Procedure.i Start()
                      
            CompilerIf Essai::#Mode_Debug = #True
                  Debug Essai::String_1$
                  Debug Essai::String_2$
                  Debug Essai::String_3$
            CompilerEndIf
            
      EndProcedure
      
EndModule

Essai::Start()

Re: Module bad understanding

Posted: Sun Apr 16, 2023 7:42 am
by STARGÅTE
I can't understand your problem.
If I run your code, no error occurs.

If #Mode_Debug is defined as #False, then String_1$ to String_3$ will not be defined as global.
So you can use String_1$ to String_3$ only in Start() if #Mode_Debug was #True.
You do not need Essai:: before.

Re: Module bad understanding

Posted: Sun Apr 16, 2023 4:27 pm
by Fred
It works fine as well here

Re: Module bad understanding

Posted: Mon Apr 17, 2023 6:59 am
by Denis
I've installed 6.02 b1 and uninstalled previous versions.
With 6.02 b1 it works normally.

So i reinstalled 6.01 LTS and it works normally... :shock:

All that give me headache.

The real question was why compiler tried to compile when the condition was false.
With a clean reinstallation of 6.01 LTS it's OK.

So, for me the question is over but with interrogations...