News for hackers. Stuff that matters.
Re:Fear of Macros by pg314 on Wednesday June 10, 2015 @06:39PM (#9696132)
The with-x style macros can indeed be replaced by functions that take a closure. E.g. in Scheme you have the function (call-with-input-file string proc).

The macro is slightly more concise. Contrast

  (with-input-file (x "x") (print (read x))) ; Common Lisp
with

  (call-with-input-file "x" (lambda (x) (print (read x)))) ; Scheme
Re:Fear of Macros by chaoky on Wednesday June 10, 2015 @09:35PM (#9696921)
No runtime consing of closures either! In fact, in Common Lisp there is a style of writing call-with-foo that takes a closure and wrapping that with a macro with-foo. Since the macro abstracts that detail of having call-with, it is much more flexible. For example the macro could expand some stuff known at compile time and do some compile time computation too., instead of the closure consing function.