In J system there is no clear separation of a running program vs non-running. There are definitions in memory, and they run when called. So a program is a loose collection of definitions in memory.
To change a loaded program you need to change the definitions in memory by executing "name=: definition". It does not matter how this execution is performed: loading a script, executing a literal noun, from immediate session window, etc. There is no intrinsic connection between the script in the file and definitions in memory. E.g. there is no such thing that after loading a script, you change and save it and it automatically gets picked up into memory. One way to hotswap (one or more) definitions is - open script in J session - Ctrl+W to load it (and run the last line to start program) - change a definition in script window - select the definition and Ctrl+E Thus only the selected definition will be replaced and the program will change in memory and will start new behavior when that definition is called again, as in event handler. Using this idea, it is possible to replace definitions from the program GUI, without the J session windows, thus implementing the "plug-in" or "macros" design pattern, so that customizable and extensible modules are changed in memory as well as on disk for later use. In fact, J is especially suitable for this extensibility pattern, as other languages have to support either special scripting extensions or very complex dynamic compilation. Whereas any J code and programs can be viewed as extensibility plugins of the J system itself. --- Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]> wrote: > I donot yet know whether the question I asked has been answered. > > Second try: > Example: Oleg published a SQLite addon at http://olegykj.sourceforge.net/ that > includes a browser for the sqlite database and is in a single script file " > browser.ijs" > > This is a windows based application that explores the database stored in a > *.sqlite file. So, the application keeps running till the user closes it. > > Now, in this context, > 1) Can the script file be changed? It seems all the following work - change > the contents, move/delete file. > 2) After the change, how to inform J to reload the changed file without stop > and restart of the application? > > > I had a look at the project manager and created a project. But I am not able > to see how the project manager allows for "hotswap" of script - by which I > mean that J should allow for modification of source script and reload the > script when appropriate (or can be forced to do it) *without stopping the > current execution of the script.* > > > > > > > > > ----- Original Message ---- > > From: Yuvaraj Athur Raghuvir <[EMAIL PROTECTED]> > > To: Programming forum <[email protected]> > > Sent: Wednesday, October 11, 2006 4:20:45 AM > > Subject: [Jprogramming] "Hotswap" of script > > > > As J is interpreted, I understand that the scripts can be changed > > on-the-fly. > > > > 1) Assuming I am creating a stand alone application that has one big ijs > > file, how does this work? > > 2) Or is there a specific way of organizing the scripts to allow this? > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > > > > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
