|
|
|
|
|
by mschaef
3385 days ago
|
|
Sure, functions can do that and more (borrowing a page from Smalltalk): (if* cond
#'(lambda () then)
#'(lambda () else))
All the macro does is eliminate the need to write out all the lambda syntax. (defmacro (if cond then else)
`(if* ,cond
#'(lambda () ,then)
#'(lambda () ,else)))
This brings my back to my original point: "the extent of the logic encoded in macros should be minimized, with the macros translating the code pretty much straight away into something built on more functional abstractions.".Works in C too, although not as nicely: void dscwritef_impl(const _TCHAR * format_str, ...);
#define pdscwritef(flag, args) \
do { if (DEBUG_FLAG(flag)) dscwritef_impl args; } while(0);
The funny thing is, I think we're largely in agreement. |
|