1. Re: Missing Feature in Euphoria

Jeff Zeitlin writes:
> Then we hit a biggie - Euphoria doesn't have the equivalent of a
> "CHAIN" statement, where one program could execute another with
> no return to the original program, but also without loading a
> new copy of the interpreter.  Another option was to let the
> chained program return to the main program, which would then
> theoretically exit immediately, but again, no go - there's no
> way to load another .ex file without also loading another
> interpreter.

Normally people use system() to run another program,
but you are right - it will start another interpreter

However, if you have two programs p1.ex and p2.ex, you can say:

   include p2.ex

in p1.ex, at the point where you want to "CHAIN".

If you don't want to hard-code the name "p2.ex" you can
copy a file into, say, temp.ex just before including temp.ex.
    chain_to = "p2.ex"
    system("copy " & chain_to & " temp.ex", 2)
    include temp.ex

The BASIC program that you are converting was probably
doing the CHAIN because it couldn't load both parts of
the program into memory at once. Probably it was limited
to 640K, or even 128K if it's QBasic. In Euphoria you can
likely merge the two parts into one and have lots of
memory to spare.

If p1 and p2 don't share variables you could simply have
a .bat file that will run one .ex followed by the other:
    ex p1.ex
    ex p2.ex

  Rob Craig
  Rapid Deployment Software

new topic     » topic index » view message » categorize


Quick Links

User menu

Not signed in.

Misc Menu