[ALLY] REBOL Modules Doc Re:(5)
From: rebol:techscribe at: 4-Aug-2000 18:07
Hi Petr,
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"
>> chat
>> ]
>>
>> Looks quite useful to me!
>>
you wrote:
>yes,
:-).
>just a few comments.
Yikes!
>your solution provides only solution for remotely
>placed modules. but - what about functions, objects, words? Wouldn't it be
more
>general if we would be able to type e.g. ble: make/target image! 200x200
'url?
>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
must be
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! [
url: rebol://rebol.TechScribe.com/remote-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
for
>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.
>future:
>
>joke: make/target function! [][call "set time 11:00"]
>
>"Hey Elan, type 'joke at your console - just trust me. Hmm, what? Did
nothing?
>Perhaps buggy. Well go to bed and start your timer"
>
>Elan:
>
>->> awake-me 06:00
>
>pekr:
>
>"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
http://www.REBOLpress.com
visit me at http://www.TechScribe.com