brendan at mozilla.com
Mon Jun 27 10:43:14 PDT 2011
On Jun 27, 2011, at 4:49 AM, Lasse Reichstein wrote:
> On Sat, 25 Jun 2011 05:50:05 +0200, Brendan Eich <brendan at mozilla.com> wrote:
>> Let's get back to the problems with JS functions:
>> 3. Tennent's principle of abstraction violations other than 'this'.
> Why is this a *problem*?
We've been over this, see Dave Herman's recent reply where he talked about macros. Now Dave was careful not to endorse block-lambdas ahead of having macros, but the reason macros want lambdas applies just as well to many hand-coding "human macro processors", too.
Tennent's observation is really about refactoring, eta-conversion if you will. JS today makes that hard. With block-lambdas it is easy.
> I guess the summary would be: I don't think Tennent's principle of abstraction can be meaningfully applied to control flow when your abstraction can survive the control flow that created it.
Closures survive control flows that create them, and they can throw exceptions. That's different in some ways from the situation with return from a block-lambda whose containing function activation has died, but not materially in practice, from all I hear (from Smalltalk, Ruby, and E users).
It's easy to make this a "problem" in advance of evidence. I'd rather not argue hypotheticals. This may mean prototyping block-lambdas and user-testing them, although that will not be conclusive unless there are strong negative results (which could be worth it).
More information about the es-discuss