A very, very simple example of a typed packet.
input: 4 bytes
if there are 4 bytes remaining in the stream then grab the next 4 bytes else declare error end if wrap header and trailer onto the 4 bytes
tag = flexible number of bytes, last byte has low bit set
int8 = 00000001
int16 = 00000011
int32 = 00000101
int64 = 00000111
See early dynamically typed languages for ideas on how best to arrange tags.
See, also, Huffman encoding.
See, also, network packet layout.
The physical layer carries bytes from one Component to another.
Each packet has a header and a trailer, in the form of flexi-tags.
- header (array of bytes terminated by low bit set)
- payload - array of bytes
- trailer - must match the head (exactly)
ECC means Error Correcting Code.
We can check the packets using a variety of techniques, at a layer above the physical layer.
In this example, we produce 6 bytes (header, 4 bytes, trailer)
0x07, ??, ??, ??, ??, 0x07
output of this stage = 6 bytes
Note the similarities between this scheme and network packets.
A useful starting point might be the OSI Model for data packets.
Some Components “do something” and others simply perform type-checking.
Today, we chop type-checking up into two pieces:
- input validtation
- type checking.
This scheme appears to be inefficient, except when compared to passing JSON character data around in a network.
Is it possible to optimize this model?
We simply perform type-checks in the PE1 (at “compile time”) as we hook Components up.
This kind of optimization is nothing new.
We simply move “compile time” into the PE.
Table of Contents
Programming Environment. ↩