Brian Harvey wrote:
>> a case of performance optimization being valued over expressiveness 
>> and generality.
> 
> See?  WG1 -> expressiveness, WG2 -> optimization.  Neither a subset of the
> other.

There's more here than just optimization.  In most cases, code that's 
easier for machines to optimize is also easier for humans to reason 
about.  Using first class environments to either implement or, as Bear 
suggested, define the semantics of macros is an almost perfect example 
of this.

Macros are fundamentally about transforming code prior to its ultimate 
evaluation.  No amount of clever hacking can change this.  Conflating 
the transformation phase with the evaluation phase, which is what macros 
defined in terms of first class environments do, makes code harder to 
reason about.  Simply having ordinary code use first-class environments 
makes things harder to reason about, since it reduces the number of 
guarantees that can be made about the meaning of the code.

Macro systems like syntax-case let you manipulate environments at 
transformation time, which is when macro systems should let you 
manipulate environments.  But there's no good reason for the internals 
of that manipulation to spill over to runtime.  In particular, you 
really don't want to have runtime code depending on further code 
transformations in order to function correctly, unless your goal is to 
write obfuscated programs.

Of course, there are situations where first class environments can be 
useful.  Nothing stops them from being added as an independent 
abstraction, though, and a number of Schemes do that, the point being 
to only pay the cost for them when you use them.  That cost would 
otherwise be paid not just in terms of machine optimization, but also 
human understanding of code.

Anton


_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to