[ALLY] REBOL Modules Doc Re:(5)
From: rebol:techscribe at: 4-Aug-2000 18:07
In response to my example:
>> cell-phone: make module! [
>> title: "cell phone module"
>> url: http://www.rebol.com:6130/chat-server-module/
>> signup "me" "rebol-room"
>> Looks quite useful to me!
>just a few comments.
>your solution provides only solution for remotely
>placed modules. but - what about functions, objects, words? Wouldn't it be
>general if we would be able to type e.g. ble: make/target image! 200x200
>As 'url is represented by schemes, even ram:// or ram-disk:// could be
>introduced to rebol.
I disagree (surprised?) with you, that the remote module extension is not
general enough. Yes, any function, image ... that is to be shared remotely
a) defined in a module, and
b) accessed from within a module.
But that is only a limitation in as much as giving the host the ability to
control what he wishes to expose on his REBOL server. And that is a
sensible limitation. Other than that, if you read what Carl wrote about
modules, your scripts will always be evaluated in the context of some
module. Remember that any script you load - if it is not a module - will
nevertheless be evaluated in the context of the USER module.
This means that if you wanted to create a function based on an
argument-block and body-block combination derived from a remote machine,
then given an evaluated module on a remote machine:
remote-module: make module! [
export: [arg-block body-block]
arg-block: [a b]
body-block: [print [a b]]
a client could create his local function:
local-module: make module! [
local-function: make function! arg-block body-block
Since REBOL does not find the words arg-block and body-block defined in the
module local-module, and since local-module includes the url
rebol://rebol.TechScribe.com, his local REBOL interpreter will connect to
the remote REBOL interpreter located on TechScribe.com, at a specific port
address that is defined by the rebol:// protocol, and bind local-function
to a function that is created in the local REBOL instance, by using the
blocks on the remote machine for the function's prototype.
>In any case, it would require REBOL to have some kind of default protocol
>RPC, as not all types of schemes are suitable for such kind of behavior.
Perhaps an implementation of XML-RPC would be sufficient? We really should
be able to implement that right now.
>joke: make/target function! [call "set time 11:00"]
>"Hey Elan, type 'joke at your console - just trust me. Hmm, what? Did
>Perhaps buggy. Well go to bed and start your timer"
>->> awake-me 06:00
>"Hehe, Elan will sleep a little bit longer ;-)))"
Hey, what time is it, oh, no, have to run.
;- Elan [ : - ) ]
author of REBOL: THE OFFICIAL GUIDE
REBOL Press: The Official Source for REBOL Books
visit me at http://www.TechScribe.com