Page 1 of 1
XIncludeFile "filename.pb" As ModX
Posted: Wed Jul 27, 2016 10:26 pm
by the.weavster
As an alternative to the verbosity of
Code: Select all
DeclareModule ModX
;...
EndDeclareModule
Module ModX
;...
EndModule
How about:
Code: Select all
XIncludeFile "filename.pb" As ModX
And then a naming convention to determine which procedures/variables in
filename.pb are public and which are private so it doesn't have to be explicitly stated.
Re: XIncludeFile "filename.pb" As ModX
Posted: Thu Jul 28, 2016 9:31 am
by Bisonte
I agree
But there is one question :
If there is no DeclareModule/EndDeclareModule block... how the compiler knows what is private and public ?
Or have I misunderstood .... ?
Re: XIncludeFile "filename.pb" As ModX
Posted: Thu Jul 28, 2016 5:28 pm
by the.weavster
Bisonte wrote:If there is no DeclareModule/EndDeclareModule block... how the compiler knows what is private and public ?
I suggested a naming convention. One possible option for example:
Code: Select all
Procedure MyPublicFunction()
EndProcedure
Procedure my_private_function()
EndProcedure
So if the compiler finds a procedure name starting with a lowercase letter then it's private otherwise it's public.
I hate having to bother with Declares

Re: XIncludeFile "filename.pb" As ModX
Posted: Tue Aug 16, 2016 4:42 pm
by Mistrel
Conventions should not necessarily be standards. For example, I define my private functions with a preceding underscore.
Re: XIncludeFile "filename.pb" As ModX
Posted: Tue Aug 16, 2016 10:38 pm
by freak
An explicit public interface and a clear separation between definition & implementation encourage better information hiding which is the main purpose of modules. Usage of implicit conventions is rather counter productive in this regard.