LispOS Kernel: the Tunes approach
Sat, 3 May 1997 19:29:25 +0200 (MET DST)
>>: Fare Rideau
>: Harvey J. Stein
>> Device drivers come as very basic modules; but functionality
>> common to many device drivers can already be factored into functors
> What exactly are you talking about when you say "functors"
> in a computer programming context?
Good question. The name is taken from the SML and OCAML module systems
(on-line docs available on the WWW -- see around my Language Review page).
In this context, a functor is some kind of function
that operates on modules to give a new modules.
In this way, instead of having a TCP/IP "stack"
made of statically nested modules, the FoxNet project (OS in SML/NJ)
has components that can be reorganized in many ways,
so you can arbitrarily recombine drivers and protocols, etc.
Hence, things like achieving TCP/IP over a telnet session become trivial.
Of course, anything that can be statically done with functors
can be statically done without (see T-tarpit),
much like we could do everything in C under Unix.
Functors are a neat feature for any module system;
they allows higher-order reuse of code accross modules;
they allow classes to be organized in other ways
than a mere inexpressive "inheritance" hierarchy.
Absence of functors leads to a intermodule mess, and bad code reuse.
Emulating them means basically means explicitly simulating
environments containing higher-order functions
and first-class class/type descriptions.
I consider the Linux VFS, NET3, CDROM, and SCSI layers
to be as many manually implemented functors. I am not familiar
with FreeBSD sources, but I guess they're having similar tricks.
Of course, first-class environments, that I strongly recommend
as a proponent of a fully reflective architecture in general
trivialize modules and functors.
We need expose them anyway while implementing the system,
and they have many other advantages
(i.e. trivial representation of directories as environments, etc).
The fully reflective architecture I propose
makes everything a first class object,
with ways to remove overhead at compile time, which implies the ability
for the compiler to detect or be hinted which features will not be used,
and for the dynamic envirionment to check and enforce such invariants.
[Even Linux has first-class modules, though C not being a scoped language,
they hardly can provide functors].
It is my belief that reflective programming is
the natural generalization of dynamic programming,
that solves open implementation and many other problems.
== Fare' -- firstname.lastname@example.org -- Franc,ois-Rene' Rideau -- DDa(.ng-Vu~ Ba^n ==
Join the TUNES project for a computing system based on computing freedom !
TUNES is a Useful, Not Expedient System