Re: Help with plugin concept
- Posted by "Juergen Luethje" <j.lue at gmx.de> Feb 14, 2004
- 660 views
Rob wrote: > Igor Kachan wrote: >> Please, couldn't you explain more detailed what do you >> mean when you say it does not work and it won't work. >> What a reason ? > > The example code that you posted was... > > P_S = open ("plugins.ew", "wb") > puts(P_S, PluginS) > close(P_S) > > include plugins.ew > > The above code depends on the open() and puts() taking place > before the include is processed. With the current > interpreter that's what happens. With the current > binder and translator that's not what happens. > Rather, the binder and translator process the include file > (and all other source code) first. Execution of statements > happens later at run-time, when it's too late > for the open/puts to have the desired effect. > > In the next release, with the clearer separation between > front-end and back-end, the interpreter will also > process the include (and all other source) > before it executes any code. > It will be simpler this way. I don't think a lot of > people are actually using the above "dynamic" include > technique, although it has been discussed on this list > from time to time. > >> I run interpreted program to create the resulting include >> file then run binder or translator with *ready* resulting >> include file and *it works*. > > That's fine. You are first running a program that creates > an include file, then *in a separate step* you are using that > include file for translating or binding. However, the users > of your program might not have the translator or binder, > and even if they did, they might not want to run it. <snip> I believe using the next version of the interpreter, programs still can take advantage of a dynamic include technique, when the code is just put into 2 files rather than 1. Then again there are 2 separate steps: ------------------------[ part1.exw ]------------------------ P_S = open ("plugins.ew", "wb") puts(P_S, PluginS) close(P_S) system("exw.exe part2.exw", 2) ------------------------[ part2.exw ]------------------------ include plugins.ew -- Here comes the main program ... ------------------------------------------------------------- This should work with the interpreter 2.5, shouldn't it? Regards, Juergen