This is my take on how the new INCLUDE statement works in 4.50 ... works just like the CALL statement, except that if your tokenizing a script, it will "embed" or "include" these external scripts inside the generated KX (tokenized) script itself, by way of example:

1) Create a script called SUB.KIX that contains the following:

SUB.KIX

$X = 100
$Y = 200

2) Create a "mainline" script called MAIN.KIX that "uses" this external script, will use the CALL statement for this first example:


MAIN.KIX

break on

call "sub.kix"

?"x=" $X
?"y=" $Y


3) If you just run the mainline script, you would get this expected result:


C:\>kix32 main.kix

x=100
y=200



4) Now, change the CALL statement in MAIN, to be an INCLUDE statement, and run it again (the same result, INCLUDE is like a CALL):


MAIN.KIX

break on

include "sub.kix"

?"x=" $X
?"y=" $Y


C:\>kix32 main.kix

x=100
y=200


5) Now here is the neat part, tokenize MAIN.KIX into MAIN.KX, like this:


C:\>kix32 /t main.kix


6) Then run MAIN.KX and you get this:


C:\>kix32 main.kx

x=100
y=200


7) Now - the really cool part, delete (or rename away) the original SUB.KIX file, the MAIN tokenized script still works because SUB.KIX is "part of" (it's been included into), MAIN.KX, like this:


C:\> ren sub.kix sub.tmp

C:\> kix32 main.kx

x=100
y=200


If you ran the original (untokenized) MAIN.KIX again, it would fail, because SUB.KIX is not there !

Here's more, been doing much testing with using FUNCTION calls in INCLUDED scripts, and I am getting nasty Kixtart crashes - so think Ruud had some more work to do with functions in included files.

-Shawn