The RUN statement has a new form. If I want to use mymodule.bas as a module in a program I am writing I would code it like this:
run "mymodule.bas", #myModule
This causes mymodule.bas to be compiled into memory. It will execute code up to the first wait statement. This is how values will be initialized. The program then becomes an object assigned to the #myModule handle.
Then you can call any function on that program from within the calling program, like so:
#myModule myFunction(myParameter)
or even use the invokation in a more complex expression:
print "digits: "; len(#myModule myFunction(myParameter))
You may recognize this syntax as being the same as for controlling widgets. It relies on the same underlying mechanisms to do its work.
When were done with this, modular programs loaded this way will be cached in memory and will only recompile when the source file changes.
0 comments:
Post a Comment