To use a module element I am already starting in the hole with '::' everywhere vs 'xxx_' from includefiles.
I will study it more, but my initial reaction is includefiles are swifter and less wordy.
Thanks for the discussion and v5.2

Inevitable maybe it's too strong. Even if I believe you can reach the point.Fred wrote:I don't see where it's "inevitable".
If I'm not mistaken namespaces (modules's cousins ok... not the same thing) available in many languages can be split on multiple files, simply repeating the namespace declaration in each one. That's something I would use.Fred wrote: It has been widely adopted by the industry since a while, nothing new here so I don't see why PB should "innovate" in this domain.
OK. Just to be clear it wasn't intended in a diminishing way. With old I just meant "the pb compiler has it was before, with no idea of the concept of modules inside it and not built with them in mind".Fred wrote: ps: btw, there is no "old" compiler, as there is no "new" compiler
@freakfreak wrote:Simply put: Modules allow the separation of the code into parts that are isolated from each other. There is no risk of things like global variables or procedure names conflicting with other code parts. Only the code of a module defined in the "DeclareModule" block is accessible from the outside. This allows to break down a project into smaller/simpler parts that each can be coded separately without them interfering with each other...
Code: Select all
; THIS IS THE MAIN LIBRARY FILE
;
DeclareModule
Structure Banana
TastesGood.l
EndStructure
Declare ProcFromFile1()
Declare ProcFromFile2()
Declare ProcFromFile3()
EndDeclareModule
Module myStuff
Structure myPrivateBanana
TastesGoodToo.l
EndStructure
; some private "global" vars...
global huh.l
global IfYouSaySo.s
XIncludeFile "File1.pbi"
XIncludeFile "File2.pbi"
XIncludeFile "File3.pbi"
EndModule
Sure, using includes to split them is not a problem.fsw wrote: It looks like Modules can be separated into several files if it's done like that:
I didn't experiment with macros + modules yet.fsw wrote: The only "trouble" I had so far is that macros need to stay outside of module declarations.
section, but it talks about music modules.PureBasic - Module
Especially FreeModule or LoadModule might be used for the wrong thing.DeclareModule
EndDeclareModule
Module
EndModule
UseModule
UnuseModule
CatchModule
FreeModule
GetModulePosition
GetModuleRow
IsModule
LoadModule
ModuleVolume
PlayModule
SetModulePosition
StopModule
Code: Select all
DeclarePackage
EndDeclarePackage
Package
EndPackage
UsePackage
UnusePackage
Code: Select all
package myStuff
Code: Select all
package main
Could you post a short snippet that demonstrates the issue?fsw wrote:The only "trouble" I had so far is that macros need to stay outside of module declarations.
(otherwise my example app crashes after start...)