diff options
authorjao <>2022-07-31 04:32:35 +0100
committerjao <>2022-07-31 04:36:04 +0100
commitb1c520f57da0131cec7a32fc0f4df4fcd1549899 (patch)
parent101a4b081648bad9332a644dbb6bf5f7b0f4cd1f (diff)
playing with eli's toys
-rw-r--r--img/mzfam.pngbin0 -> 57336 bytes
2 files changed, 54 insertions, 0 deletions
diff --git a/img/mzfam.png b/img/mzfam.png
new file mode 100644
index 0000000..2dbd39e
--- /dev/null
+++ b/img/mzfam.png
Binary files differ
diff --git a/posts/ b/posts/
new file mode 100644
index 0000000..27185a1
--- /dev/null
+++ b/posts/
@@ -0,0 +1,54 @@
+#+title: playing with eli's toys
+#+date: <2007-05-20 02:41>
+#+filetags: programming auld norss
+Some weeks ago, as a way to give a serious try to the PLT environment, i wrote
+my first (and only so far) PLT package, [[][MzFAM, a File Alteration Monitor for
+MzScheme]]. MzFAM consists of a set of PLT-scheme modules providing utilities to
+monitor and react to filesystem changes. It exports a high-level interface
+consisting of monitoring tasks that run as independent threads and invoke
+callback procedures each time a file alteration is detected. These high-level
+tasks are implemented using either Linux's [[][FAM]]/[[][Gamin]] monitors or, in systems
+where it is not available, a pure Scheme fall-back implementation. (A native
+implementation for BSD systems, based on the [[][kevent/kqueue]] system calls (see
+also [[][this nice article]] to learn more), is on the works.)
+As you'll see in the link above, i took the time to (try to) write a decent
+user manual, using [[][tex2page]] (which is included in the PLT distribution, but
+can be used as a standalone program), a nice tool to write HTML manuals using
+TeX markup and, if you're so inclined, embedded Scheme directives.
+MzFAM's implementation served me as an introduction to a couple of wonderful
+Scheme libraries, both of them authored by Eli Barzilay. In the first place, i
+needed a foreign function interface to access FAM's C library. Eli's [[][FFI]] is
+just a piece of beauty: aided by the magic of /dlopen/ and friends, one can
+access C libraries without writing a single line of C code. See, for instance,
+[[;a=headblob;f=/][this wrapper]] of the kevent/kqueue system calls, which will hopefully work as a
+non-trivial example while you read the [[][FFI manual]]. Will Farr has also put the
+FFI to [[][pretty good use recently]].
+MzFAM has to choose at run time among several underlying implementations of
+the monitoring, and i've used generic functions to fulfil this need. No
+rocket science here: run-of-the-mill polymorphism is enough, but i took the
+chance to play with the second of Eli's jewels, namely, his implementation of
+CLOS for Scheme, [[][Swindle]]. Now, Scheme object systems are a dime a dozen, and
+many of them claim some degree of resemblance to [[][CLOS]], but Swindle is, by a
+long stretch, the closest to the real thing i've used--why, there're even some
+syntactical spots where it is actually nicer than CLOS itself, and is the only
+(besides Dorai Sitarm's [[][ScmObj]]) Scheme object system i know of that provides
+before/after/around advising. Swindle also comes with a fairly complete MOP
+implementation, and i'm looking forward to using it after reading [[][Andreas
+Paepcke's book]] on CLOS (which, incidentally, i bought after reading its freely
+available chapter 3, [[][User-Level Language Crafting: Introducing the CLOS
+Metaobject Protocol]] (PS)). All that said, please don't take MzFAM as a good
+example of putting CLOS to work: i'm just a beginner.
+Finally, let me mention another nice PLT feature i've used (although this one
+is not, as far as i know, an Eli's hack): the [[][PLaneT Package
+Repository]]. Extremely convenient, and a breeze to set up, both from the user's
+and the developer's perspective, and yet another reason for giving PLT a
+serious try.
+Happy monitoring!