Page 1 of 1

Extend UseModule to accept a file name as 2nd argument

Posted: Mon Jul 01, 2013 8:24 pm
by fsw
Until now I could do this:

Code: Select all

XIncludeFile "myGUI_3v1.pbi"
to get access to my lib.

With Modules I have to do that:

Code: Select all

XIncludeFile "myGUI_3v1.pbi"
UseModule myGUI
In the future it would be awesome to allow this:

Code: Select all

UseModule myGUI "myGUI_3v1.pbi"
You must have realized by now I'm an lazy old fart :mrgreen:
Thanks for reading.

Re: Extend UseModule to accept a file name as 2nd argument

Posted: Thu Jul 04, 2013 3:05 am
by Tombmyst

Code: Select all

Macro UseModuleLazy(name,file)
	XIncludeFile file
	UseModule name
EndMacro
Do never forget the power of macros!

Re: Extend UseModule to accept a file name as 2nd argument

Posted: Thu Jul 04, 2013 2:09 pm
by blueb
fsw wrote: In the future it would be awesome to allow this:

Code: Select all

UseModule myGUI "myGUI_3v1.pbi"
If I am asking to include a PBI file in my program,
I think everything inside the PBI file, such as Modules
should be usable in my program.

That's why I'm including the file in my code.

I shouldn't have to state the obvious. :shock:

blueb

Re: Extend UseModule to accept a file name as 2nd argument

Posted: Thu Jul 04, 2013 3:15 pm
by luis
blueb wrote: If I am asking to include a PBI file in my program,
I think everything inside the PBI file, such as Modules
should be usable in my program.
That's why I'm including the file in my code.
I shouldn't have to state the obvious. :shock:
Considering there are two ways to access a module: UseModule and "nameofthemodue::object" and the fact they have very different implications the idea of always applying a "UseModule" to every module included it's a very bad one.
There are more reasons, but this is enough already. :wink: