archives

Typed Data

While things are quiet seems like a good time for a question with a tenuous link to programming languages. Unix has been designed around the idea of plaintext as a universal interface between programs. It is not the only possible universal interface; there are many possible binary formats with strictly defined syntax and a flexible definition of semantics.

What previous attempts have been made to make a unix (posix) core that operates on a different interface?
- Replacements for the standard set of tools (awk, sed, grep, cut, paste etc)
- A replacement editor for serialised streams (e.g. the equivalent of a text editor)
- Changes to the runtime interface in libc to replace stdin/stdout and read/write etc

I am aware of Microsoft's work on powershell, but replacing the textual interface with objects introduces a complex set of semantics. What I am asking is if anybody has tried something simpler? In particular - a typed representation for data, that may look something like an Algebraic Data Type. A fixed binary encoding for:
- integers
- floats
- strings
- a list type structure
- a form of nesting to allow trees

The rough idea here would be to take something as expressive as s-exprs, but combine it with a fixed binary encoding, probably a chunk-based format like the old IFF syntax from the Amiga file-system. This idea keeps floating back up every year when I teach the posix core to students. Unfortunately it does not suggest a project that I can give to a student (too much programming, very weak / undefined comparison with previous work). Some day - I may sit down and start hacking, but before then it seems interesting to point out that this is quite an obvious departure point from the unix design philosophy - has anybody been down this road before?