Noah Lavine writes: > Hello all, > > I just completed packaging Alex Shinn's fmt library for Guile, and I'd > like us to include it in the trunk. The library's home page (with > documentation!) is http://synthcode.com/scheme/fmt/. > Not that I have any say in that, but IMHO, it would be preferable to keep external libraries maintained separatly from the Guile core; however in this case, including it in the core might be justified by its proposed use in the JIT compiler. FWIW, there's already an R6RS adaption of "fmt"[1] as part of the Wak project[0], which works nicely with Guile (from the stable-2.0 branch). [0] http://home.gna.org/wak/ [1] http://gitorious.org/wak/wak-fmt > It looks like a nice formatting library, > Indeed! > and I imagine it would be useful to people who want to generate html > for the web module. > For that, I'd rather suggest building up SXML and use SSAX[2] or HtmlPrag[3] for serialization. [2] http://ssax.sourceforge.net/ [3] http://www.neilvandyke.org/htmlprag/ > However, the real reason I want it in is because it has the ability to > format C source code nicely, and all of the plans for the JIT complier > involve automatically generating a lot of C. > Yeah, that makes sense. > (I'm only attaching the basic library right now, but I hope to package > up the C formatting stuff soon.) > Well, the Wak adaption has this stuff already done ;-). > The files are all attached. To use the library, put all of the files > in a folder, open Guile in that folder, do (load "fmt-guile.scm"), and > then (use-modules (fmt fmt)). If you want to test the library, do > (load "test-fmt.scm"). It passes all tests on my machine. > Having a quick glance at the code, I think you should refrain from using `load', and use `include' instead (it seems that the latter is undocumented, unfortunatly). Also, it should not be necessary to `load' any file before doing `(use-modules (fmt fmt))' -- the latter should be enough if the code is organized appropriatly (i.e. files placed into the right directories). You might want to have a look at how the R6RS port is organized (see the git repo at [1]). > fmt-guile.scm is a new file, but the other ones are almost identical > to the upstream version. I'm going to try to get the changes merged so > it will be easy for us to maintain. > Could you produce a diff? FWIW, I've attached the changes in the Wak adaption -- there are only differences in the test suite, which uses some implementation-specifics, and also `cond-expand' which is not available on Racket (which is one of the implementations targetet by Wak). I've not yet bothered to submit those upstream, since I assume they would not be accepted, as they (a) disable some tests that rely on implementation-specific extensions (b) probably break on the author's system.