Looking over this quickly, question: You use a variable, html-nestlev, inside a closure as a sort of hidden global variable, and use it to indicate the depth of quoting... What happens when an error or ctrl-C happens in between an (html-openq) and (html-closeq)? That might be worth handling. You might try Racket's parameters, or have a function that resets the thing.
Also, you ask in a comment: "way to warn not on stdout?" If stderr suffices for this, you might like this:
(mac to-stderr body
`(w/stdout (stderr) ,@body))
which "warn" should probably really be defined with. And if you might like to redirect stderr somewhere (like a log file), I recommend you add these lines to ac.scm, near "xdef call-w/stdout" and "call-w/stdin":
Thanks. I started to use your to-stderr when I noticed this similar function in arc.arc:
(def ero args
(w/stdout (stderr)
(each a args
(write a)
(writec #\space))
(writec #\newline))
(car args))
I'll probably use it instead just to keep this lib's dependencies to the arc3.1 core. I agree it would make sense to have call-w/stderr in ac.scm, though.
> You use a variable, html-nestlev, inside a closure as a sort of hidden global variable, and use it to indicate the depth of quoting... What happens when an error or ctrl-C happens in between an (html-openq) and (html-closeq)? That might be worth handling. You might try Racket's parameters, or have a function that resets the thing.
Really good point. Need to think about this more, as I'm feeling doubtful about that whole part of the program relating to nested quotation.
Update: For those just tuning in and looking for the variable html-nestlev in the source, it's been renamed to nestlev.