On Thu, 2 Jan 2014 15:30:32 +0100 Panicz Maciej Godek <godek.mac...@gmail.com> wrote: > After reading some of the original paper by Dybvig[1], > I finally managed to get the macro right. The trick > was to use "with-syntax", which -- I have to admit > -- is still a little magical to me. But by mimicking > the way the procedure "generate-temporaries" has > been used in the Dybvig's implementation of letrec, > I came up with the following solution: [snip]
Chapter 8 of Dybvig's "Scheme programming language, 4th edition" [1] has a less fulsome but more exampled explanation of 'with-syntax' which might be useful. I found it helpful recently in order to implement a version of 'guard' which works with native guile exceptions - guile's r6rs 'guard' does not do so[2]. Chris [1] http://www.scheme.com/tspl4/syntax.html#./syntax:h0 [1] In doing this, I also discovered that guile's r6rs 'guard' is not r6rs compliant, because if the exception concerned is rethrown because there is no matching handler clause, it does so without first restoring the dynamic context to the one in which the exception was raised. Having said that, I prefer guile's behaviour; and you won't notice the difference unless you have a dynamic-wind in there somewhere.