On Sat, May 30, 2015 at 4:02 PM, Peter Bex <[email protected]> wrote: > On Sat, May 30, 2015 at 03:42:41PM +0200, Michele La Monaca wrote: >> On Sat, May 30, 2015 at 4:23 AM, John Cowan <[email protected]> wrote: >> > Jinsong Liang scripsit: >> > >> >> I want to learn some basic macro programming in Chicken. However, it seems >> >> there are multiple macro definition APIs in Chicken: define-syntax, >> >> syntax-rules, syntax-case, define-macro. Which one should I start with? >> > >> > Define-macro is completely obsolete and not supported in Chicken 4 or >> > any modern Scheme. >> >> Gambit has it. Too bad Chicken 4 dropped it. >> >> I don’t think describing define-macro "obsolete” is 100% correct. > > As has been pointed out time and again, it is fundamentally broken.
Ok, I trust you then. > Looks like you are mixing up two things: on one hand, define-macro > offers the syntactic convenience of not having to pick apart the input > form. On the other hand, define-macro does not support hygienic > renaming at all (except for gensym, which only works on identifiers > created by the macro itself). I have no use of renaming in my example so I am mixing up nothing. BTW, I am not interested in "protecting" eval and cons if you were asking. > If it's the syntactic convenience you're after, take a look at the > "bindings" egg by Juergen Lorenz. So you first mess with the define-macro syntax then redirect me to an egg to fix it up again. No thanks. > It offers various improvements > on the basic er-macro-transformer and ir-macro-transformer syntax. >> >> (let ((x 9)) (apply-any or '(#f (+ x 1) (print "hello")))) >> >> Error: unbound variable: x >> >> Oops. > > Eval does not have access to the lexical scope where it is > invoked. Exactly. But it looks like you missed the point. Hint: reconsider the "where" word. Regards, Michele _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
