Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: 'use question

From: maarten:koopmans:surfnet:nl at: 30-Oct-2002 5:33

of course.... Why would I want to access hidden, local varaiables? I have been wondering some time about "freezing" an interpreter in a way that I can pass the state around. This would be a continuation-like-thingy that can be used in distributed computing, e.g. you have a complicated computation that is serial for the first part, then can be parallelized. You'd simple freeze the script in your fave' language and send the image around. Ans that's just a sample, now if you really have imagination.... So how to proceed? First, filter all the global word from system/words, and then filter out the natives, the actions etc. Also filter out anything I/O related. Later on we may abstract ports away as "channels" where some sort of UDP transport could be used to have the data of a "channel" follow you. Can be done, so forget it for now. Get the values, and store them in a block. Now we face our first problem: objects. We need to traverse objects to filter out all I/O related variables, and they may be nested. Tail recursion anyone? Yes, see the trhead starting with http://www.escribe.com/internet/rebol/m16658.html We also me need to change make on object! types to add a 'super word for efficiently traversing the hierarchies. So now we can save all the state of all of the defined words. What do we do with anonymous objects that bind a few words in the global context? A simple way might be storing them on definition, as we are already changing make.... But what to do with words local to a value that were created using the 'use construction? Joel said:
>> fbody: [[b] b: 10 does [b + 1]]
== [[b] b: 10 does [b + 1]]
>> f: use [b] fbody >> f
== 11
>> f
== 11
>> f >> get fbody/1/1
== 10 ... and ...
>> set fbody/1/1 23
== 23
>> f
== 24 == 11 So that one is figured out as well. Changing the way functions are defined some more to intercept the current point of control flow gives us... continuation like behaviour. That can be passed on a network? Or saved on a disk? --Maarten