Module bad understanding

Everything else that doesn't fall into one of the other PB categories.
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Module bad understanding

Post 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()
A+
Denis
User avatar
STARGÅTE
Addict
Addict
Posts: 2234
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Module bad understanding

Post 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.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Fred
Administrator
Administrator
Posts: 18224
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Module bad understanding

Post by Fred »

It works fine as well here
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Module bad understanding

Post 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...
A+
Denis
Post Reply