One more syntax option allowing nice control abstraction

David Goodenough david.goodenough at linkchoose.co.uk
Mon Jun 20 14:53:03 PDT 2011


On Monday 20 Jun 2011, Neal Gafter wrote:
> On Mon, Jun 20, 2011 at 12:21 PM, Alexander Kochurov <
> 
> alexander.kochurov at maxifier.com> wrote:
> > David Goodenough suggested to use 'lambda' keyword:
> > "lambda()(5)
> > lambda(){return 5;}
> > 
> >  lambda(int x,int y) { if (x>y) return x; else return y; }"
> > 
> > Control abstraction may be introduced later in the following way:
This line was not part of my email, all I commented on was replacing do
with lambda.

David
> Your suggestion doesn't actually provide for control abstraction because of
> the binding of the "return" construct (not to mention break, continue,
> non-final variables, etc).
> 
> To see if you've added language support sufficient to provide control
> abstraction, you might try defining a method that accepts a boolean and two
> blocks of code and acts as an "if-then-else" statement.  It needn't be
> pretty (after all, we already have an if statement in the language) but it
> should have the correct behavior *without *the contents of the "then" and
> "else" blocks being rewritten from the way they would appear in a
> language-provided if-then-else statement.
> 
> See also <http://video.google.com/videoplay?docid=4051253555018153503#>, <
> http://gafter.blogspot.com/2007/03/closures-for-organizing-your-code.html>,
> <
> http://gafter.blogspot.com/2006/08/tennents-correspondence-principle-and.ht
> ml>, <
> http://gafter.blogspot.com/2006/09/failure-of-imagination-in-language_17.ht
> ml
> 
> >.
> 
> Cheers,
> Neal



More information about the lambda-dev mailing list