Comments on: The first resident embedded module
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.
>> ? 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.
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>> get prot-http.r
--- Note: wrote file: work/r3/protocols/prot-http.r
This is good.
My only complaint is on the 'module word used to build the module.
I understand that it's like the 'context word to build objects, but it does not implied the action it does : to make a module.
So a verb would sound better to me. I'm not native english speaker so I have nothing better than 'make-module that you surely think is too long.
I understand that it's like the 'context word to build objects
Or like the OBJECT function to build objects, or the FUNCTION function to build functions, or the CLOSURE function to build closures, or the ARRAY function, or any number of other builder function that have an implied MAKE-. Don't worry about it :)
DideC: yes, I had that same concern, but like any language (especially human languages), there are always a few exceptions, just to make things readable and practical.
Post a Comment:
You can post a comment here. Keep it on-topic.