Re: [dev] Simple made Easy (Rich Hickey at StrangeLoop)

From: Anthony Martin <>
Date: Sat, 22 Oct 2011 03:13:36 -0700

Connor Lane Smith <> once said:
> So I think the necessary next step would be to have a strongly typed
> shell. To pretty-print you'd need to add a polymorphic "à la carte"
> (multiple dispatch) pretty-printing function for the given data type.
> The type inference would be done per command, so cat(1) would be of a
> type such that if you were to try catting an image (directly) to wc(1)
> it would fail, because the types (Image, String) would not match. You
> could also have awesome higher-order functions, so 'map' would remove
> the need for find(1), etc.

Then someone will ask for sub-typing and someone
else will want ADTs and we'll wake up one day and
have to learn category theory just to use a shell. :)

A while ago I thought about doing something similar
in a more general way. Say we modified the Plan 9
pipe(2) system call to check the current process's
namespace for /dev/pipe instead of using the hard-
coded pipe(3) device. This would allow us to build
custom type-safe pipes as user-space filesystems.

You could then do something like:

% jsonpipefs -m /mnt/json
% ls /mnt/json
% bind /mnt/json /dev/pipe
% produce | consume # these commands expect a serialized JSON stream

The beauty of this is that the stream typing logic
is separated from individual programs and, of course,
the shell.

Received on Sat Oct 22 2011 - 12:13:36 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 22 2011 - 12:12:04 CEST