[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macros vs. blocks





On Fri, 22 Nov 2002, Guy Steele - Sun Microsystems Labs wrote:
>    Ok, but you're moving away from the advantage of having it be a macro:
>    "there is no reason that a runtime system cannot allow you to write
>    functions that refer to the source file and line from which the function
>    was called".  ...
>
> Sure there is: as a matter of efficiency, it might well
> be undesirable or infeasible to keep all that information
> around at run time on the off chance that someone might
> need part of it.
>
> Maybe you think that's a stupid or insufficient reason,
> but it is a reason, which suffices to rebut the claim
> that there is no reason.

True.  But then the argument becomes "macros are more efficient (by virtue
of being a compile time construct) than closures", which is a much less
interesting argument, in my opinion, than "macros are more expressive (by
virtue of being a metalevel construct) than closures".  Pursuing that
argument also brings to mind all of the problems (in a mostly
late-bound language like Lisp) that come of using compile time constructs
for abstraction: I can change a function on the fly, but if I change a
macro I have to recompile everything that uses it (are there any systems
smart enough to do that automatically, btw?)