Ladislav: can INCLUDE now be used to run the same code both from sources and encapped, with no code change?
I am not completely sure what your question is, but we use it to:
1) run the code from the source 2) encap the above code as well, both at the same time
When I click on any file icon here, I usually use INCLUDE to run the code, in fact
(and preprocess it at the same time, if needed)
I just mean enabling any REBOL app to run unchanged from sources (using DO) or encapped.
what is "encapped"? once encapped, it is just an .exe here
but, certainly, I use INCLUDE to run (e.g. when testing) any REBOL application otherwise needing preprocessing, i.e. such that even could not be run by DO; of course, such applications that can be run by DO can be run by INCLUDE as well
Encapped: executable binary generated by /Encap.
Why would you want INCLUDE to run such application?
Ok, let's try another way. :-) For a given REBOL app codebase that can be run with DO, can INCLUDE be used in such codebase to enable application preprocessing suitable for /Encap while letting it still be run using a simple DO?
INCLUDE can be used wherever DO can be used. I guess that answers your question.
Or maybe I am still missing what you are asking?
Actually, what I would need would be an INCLUDE that can replace both DO and #include.
Yes, that is exactly what INCLUDE does
Can it also replace LOAD and READ (and any other function that reads REBOL or data files from disk)?
LOAD: yes, you should give it a try, IMO
(you may find some other needs and suggest improvements, but I bet the basic functionality is there for you)
Good, then I'll try it on some simple apps, if it works well enough, I'll be able to replace my own include system with it for bigger projects, like Cheyenne and Red.
I use INCLUDE a lot, for both development runs and encapping. I just use different scripts to launch them. That is, I have a %_build.r that calls INLCUDE/LINK to produce an output script, then uses DO on that. %_encap.r, the CALLs encap and does other things like setting icon and version in the EXE.
Typos. %_encap.r calls INCLUDE/LINK, then CALLs encap...
Ladislav: I just had a quick look at INCLUDE documentation, I still unsure if it can cover my needs. Let's take an example:
REBOL [ ]
do %lib/a.r do %lib/b.r
app: context [...] app/run
How can I use INCLUDE there to make this script "encappable" (can be passed to Encap for generating an executable) while still being able to evaluate it with DO? Would the following code work?
REBOL [ ]
#include %include.r include %lib/a.r include %lib/b.r