Here's a rough diagram of the IO (port) mechanism in R3:
Where: [R] is implemented at REBOL level and [C] is implemented at C level.
R3 needed to formalize the abstraction of what happens at the C layer for IO without extensive expansion of the API.
As they are in R2. They define a type of port, its specification and implementation. Examples, TCP, HTTP, SMTP, etc.
An instance of a scheme. A port is an externalized series. You open a port based on a scheme such as TCP.
A standard lower-level (C code) structure for conveying port actions to external devices. It relays commands from the higher level port to the lower level device. It is also used for replying from the device back to the port, and also for tracking the current pending asynchronous requests.
A standard model of IO. Implements a set of commands via requests, and a method of replying to requests. Extremely lightweight and flexible. Support synchronous and asynchronous devices.
Example device is basic TCP networking. (Those of you who were Amiga developers will understand the model quite well.)
Note that the request and device layers do not manifest in REBOL code. They are lower level.
A few example devices are:
special system IO such as interrupts, system shutdown, etc.
low level REBOL character streams for stdin, stdout, stderr. Very simple.
higher level REBOL console functions like the R2 console window (with menus, etc.)
local file and directory access (currently synchronous, but can be expanded to async).
TCP/UDP networking interface. Asynchronous by default.
OS and GUI event streams.
control of sound channel playback
There will be others, such as databases, video, MPEG codecs, etc.
Standardizing on a device model greatly reduces the extent of the primary API (function library) between REBOL and the hosting OS. Why? Because 80% of the interface is related to IO, so providing a standard IO abstraction shifts all of that from the API to a dynamic, extensible mechanism: I/O devices.
An additional benefit: it will be possible to implement REBOL on hardware devices and embedded systems that have little or no OS. For example, an implementation can map "StdIO" to the serial port if so desired. Then, running REBOL, the prompt would appear on the serial device. You get the idea.
IO Devices implement a specific interface model. Although quite flexible, it is still a command driven request/response model. There will be external devices with functions that fall outside that model.
Fortunately, the great range of initial devices forces a design from the start that can handle a wider range of devices. There are standard commands such as CONNECT that have meaning for networking but not for filesystems, and also the IO request structure supports 64 bit external indexing and sizing. In addition, we can add new command types as the need develops.
I'll be saying a lot more about this design soon. I will also be covering it extensively at the 2007 DevCon next month.