Hi all, This is a weird one. It looks like there's a problem with performing certain operations on syntax objects that "wrap" the empty list -- I think because such syntax objects are themselves indistinguishable from the empty list. I'm still not sure I fully understand what's going on, but suffice it to say that if you have a syntax-case expression that looks like:
(syntax-case x () ((foo . rest) (datum->syntax #'rest 'foo))) ...you get an error if `foo' is expanded without anything to bind to `rest': ;;; key wrong-type-arg, throw_args (#f "Wrong type argument in position ~A: ~S" (2 2) (2)) You can get the same error via the following code: (datum->syntax #'() 'foo) The initial error message didn't include any source information, so I connected to the process with gdb and dug around in psyntax-pp.scm until I located the following line (5459), which seems to be the culprit: (#{syntax-object-wrap\ 116}# (lambda (#{x\ 783}#) (vector-ref #{x\ 783}# 2))) What's the right thing to do here? Do you just have to be careful with what you do with pattern variables that might end up getting bound to no arguments? R6RS isn't totally clear on the topic, but, for what it's worth, the same code seems to work in MzScheme. Regards, Julian