[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: special forms, take two (was Re: A lua version of "amb")
- From: Mark Hamburg <mark@...>
- Date: Wed, 29 Feb 2012 17:53:55 -0800
On Feb 29, 2012, at 9:31 AM, Jay Carlson wrote:
> On Tue, Feb 28, 2012 at 1:32 PM, Fabien <fleutot+lua@gmail.com> wrote:
>> On Tue, Feb 28, 2012 at 2:41 AM, Jay Carlson <nop@nop.com> wrote:
>
>>> I don't think anybody's been talking about a functional programming style.
>
>> Fair enough. However, I believe that if you introduce terse and tempting
>> lambdas in the language, then you're going to entice people into writing bad
>> functional-ish code.
>
> Smalltalk-80 blocks resembled closures but were not first class
> values; they were stack-allocated. (I remember bumping my shins on
> this before implementations fixed it.) Ruby syntax wants you to use
> blocks a particular way. So I guess both of those languages threw
> stumbling blocks in front of a functional style.
If you really want to do control flow, you need blocks rather than closures with the key difference being how return statements work. A block still exists in the control context of its enclosing scope. A closure is its own control context.
Mark