[<<][sweb][>>][..]Mon Jun 15 13:47:07 CEST 2009
Problem: given binary data represented in-image, call a script that processes it (possibly using local filesystem cache) and transfer the resulting file(s) back into image. Core idea: file systems do not support garbage collection (by design, since references to files cannot be tracked due to symbolic representation / lack of type information) so they need to be abstracted as local state[1]. So what's the essential abstraction? A 1-1 map between scheme objects and filesystem object. Whenever the object disappears, the filesystem object will be deleted. In PLT Scheme this is handled by finalizers[2][3]. > (require scheme/foreign) > (define (finalize it) (printf "finalizing: ~a\n" it)) > (register-finalizer (cons 1 2) finalize) > (collect-garbage) finalizing: (1 . 2) NEXT: find an api to make this easy. I.e. define a standard file system interface and some scheme functions to create and reference objects. [1] entry://../compsci/20090615-134849 [2] http://groups.google.com/group/plt-scheme/browse_thread/thread/9ae6c5a6c331431b [3] http://www.cs.brown.edu/pipermail/plt-scheme/2005-May/008898.html [4] http://download.plt-scheme.org/doc/4.1.5/html/foreign/foreign_pointer-funcs.html#(def._((lib._scribblings/foreign/unsafe-foreign..ss)._register-finalizer))
[Reply][About]
[<<][sweb][>>][..]