REBOL 3.0

The first resident embedded module

Carl Sassenrath, CTO
REBOL Technologies
11-May-2009 3:01 GMT

Article #0199
Main page || Index || Prior Article [0198] || Next Article [0200] || 3 Comments || Send feedback

A53 modularizes the HTTP scheme.

What does that mean? It means the HTTP implementation, including it's functions and other values, are no longer part of the global context.

In A52:

>> ? sync
Found these words:
read-sync-awake function! [event [event!] /local error]
sync-op         function! [port body /local state]

Those are internal functions of HTTP and should be hidden.

But, in A53:

>> ? sync
No information on sync

That's how it should be.

Method used:

To encapsulate the HTTP module within the rest of the code, I used this line:

import module spec body

Where spec is the module header block and body is its code block.

The module helper builds the module, and import adds it to the system/modules list as 'http.

Note that the scheme port definition creation part of the protocol is within the module body itself. That mechanism is separate from modularization. In fact, the HTTP module has no exports! All of its features are accessed via the port sub-system.

To see the source, open R3 Chat, login, and type:

user>> 27
R3/Protocols...
user>> get prot-http.r
--- Note: wrote file: work/r3/protocols/prot-http.r

3 Comments

REBOL 3.0
Updated 20-Dec-2024 - Edit - Copyright REBOL Technologies - REBOL.net