Wish Suggestion : shortcut to code module (or else)

lemonisdead

Well-Known Member
Licensed User
Longtime User
Hello,
This is only an idea, perhaps it could interest someone else too. Perhaps could it be interesting to create two new methods to be able to link to code modules /and perhaps/ specific parts of a code module.
This, to be able to use that code module (or that part of the code module) without to have to reference it again in the same sub.

In another language I often use, this is done by Start using [Module's name] and Stop using [Module's name]

So we could have something like this in B4X :
B4X:
Sub MySub
Dim MyFile, MyTarget as String = "MyFile.db"
StartUsing DBUtils
MyTarget=CopyDBFromAssets(MyFile,"MyTestApp")
StopUsing DButils
....
End sub

In that other language, the part of code used is the code module itself. The code module is used from StartUsing in the same Sub until the StopUsing command is used. So it could be possible to use the Process_Globals variables from that code module without making it preceded with the module's name itself in another sub when the code module had been starting used.

An evolution (perhaps using Regions) could be to select only part of a code module encapsulated with a name to reference it only with its name and execute it in the context of the parent module itself.

Thanks for your attention :)
 
Top