No worries!
I'm glad that the problem is solved.
Modules
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: Modules
I think I'm getting the idea.
I'd like to see the Help file updated with Module commands and explanations.
I see the Module commands in 'Folding' but Module commands are not added to 'Indentation' (they can be added to Indentation and work fine).
I'd like to see the Help file updated with Module commands and explanations.
I see the Module commands in 'Folding' but Module commands are not added to 'Indentation' (they can be added to Indentation and work fine).
MacBook Pro-M1 (2021), Sonoma 14.4.1, PB 6.10LTS M1
- Michael Vogel
- Addict
- Posts: 2680
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Re: Modules
Not sure to understand the module concept fully and have no time for playing around for the next four weeks or so, but I read some postings and TI-994A brought an example which seems to show a conflict for me:freak wrote:[...] There is no risk of things like global variables or procedure names conflicting with other code parts.[...]
Code: Select all
#constant1 = "Hello"
Define a.f = 1.23
Procedure test()
Debug #constant1 + " World!"
EndProcedure
DeclareModule myModule
#constant1 = 100
Define a.i = 1
EndDeclareModule
Module myModule
#constant2 = 200
a = 2
Procedure test(param)
ProcedureReturn param + #constant1
EndProcedure
EndModule
UseModule myModule ;raises error
Debug #constant1
Debug a
Debug test(22)
UnuseModule myModule
If UseModule works similar to With*, will Debug ::a work instead of Debug a ?
____
*) Structure aStru
a.i
b.i
EndStructure
a.astru
a\b=222
b=2
With a
Debug b
Debug \b
EndWith
Re: Modules
Hello Michael Vogel. Your snippet had a number of name conflicts, and a missing module procedure. And once the UseModule directive is used, the double colons aren't required, although it can still be used with the full module name if desired, like this:Michael Vogel wrote:As I understood it, the compiler can't decide, if a is a global variable or from myModule and so on, are am right?freak wrote:[...] There is no risk of things like global variables or procedure names conflicting with other code parts.[...]
If UseModule works similar to With*, will Debug ::a work instead of Debug a ?
Code: Select all
DeclareModule myModule
a = 123
EndDeclareModule
UseModule myModule
Debug a
Debug myModule::a
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel