What Encodings Are
An encoding is an object that represents another (usually more abstract)
object. Encodings have a number of uses, but their chief use is for
communicating objects over the network. In order to be shipped from one
agent to another, an object must be encoded as a sequence of
A formal definition and an example
A type encoding is a mapping of objects from some type T to some type U.
(U may be the same as T.) An object of type T may map to more than one
object of type U, but any object of type U in the range of the mapping
must be mapped to by at most one object in type T. (In other words, the
encoding object must give enough information to rebuild the encoded
If it's easier to imagine, you can think of a decoding function
from type U to type T. A more detailed treatment of the formal semantics
of encodings can be found elsewhere.
For example, suppose we want to ship a group of pictures across the
network. We may encode them as a sequence of GIF files. This can then
be encoded into a single data stream as a Unix "tar" file. This tar file
is a sequence of bytes. We can therefore ship it across the network in
this form, accompanied by tags showing the original type of the object and the
encodings that were used to represent it as the sequence of bytes we send.
How encodings are defined
Types may have any number of encodings associated with them. Each is
defined by a unique encoding name (sometimes called the encoding method
or encoding format). The encoding definition also gives the type of the
object used for the encoding. For example, an integer may be encoded
with the method "ascii-rep", using a sequence of bytes for the encoding.
Encodings may also be registered with semantics describing them, but this
Encodings are not inherited by subtypes. If you're
using identical encoding schemes for two types, though, you may be able
to define a trivial conversion for them..
Encodings are not part of the basic definition of a type.
Converting between encodings
Any number of conversions may be used
to turn an object of one encoding into an object of another encoding.
While some conversions are designed to create a new type of object,
others simply model the same object with a different representation.
This can be useful for agents that expect an object to be in a particular
email@example.com (Last updated 4-Jan-95)