On 3/18/20 2:55 AM, Massimiliano Gubinelli wrote:
I understand the point but then it comes to the problem how to handle this in macros. For 
example if bar is a proceduce which returns multiple values and I have a macro 
"my-macro" which wraps the call with some initialization and finalization code 
and I write

(my-macro (bar))

how to write this macro without knowing if bar is returning multiple values or 
not? For example I would like the code above to expand into

(begin
  (initialization-code)
  (let ((ret (bar)))
   (finalization-code)
   ret))


But this does not work as shown by the example above. How to implement this 
macro correctly?



How about calling (my-macro/values bar) where my-macro/values expands to

(call-with-values (lambda () (bar))
  (lambda args (finalization-code) (apply values args))

Matt


Reply via email to