Anonymous methods

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Thu Jan 12 08:13:05 PST 2012


cc es-discuss

On Thu, Jan 12, 2012 at 7:58 PM, Dmitry Soshnikov <
dmitry.soshnikov at gmail.com> wrote:

> Forgot to add es-discuss to cc (original reply is below; the letter was
> sent yesterday and was the first reply); there I also proposed active
> "blocks" as "callable blocks"
>
> But in fact, if to recall the topic "Everything is expression" (which
> unfortunately became silent), it was already proposed including blocks to
> return values. Moreover, that's said since even in ES3 blocks (and in fact
> any statement) has completion result, it's easy to implement.
>
> Dmitry.
>
>
> On Wed, Jan 11, 2012 at 10:26 PM, Dmitry Soshnikov <
> dmitry.soshnikov at gmail.com> wrote:
>
>>
>> On Wed, Jan 11, 2012 at 10:10 PM, John J Barton <
>> johnjbarton at johnjbarton.com> wrote:
>>
>>> The blog post  http://yehudakatz.com/2012/01/10/javascript-needs-blocks/ makes
>>> the case for blocks that act like functions when passed as arguments but
>>> have loop-up rules more like nested blocks.
>>>
>>> Of course these are called 'block lambdas', and I suggest that this is a
>>> problem. Given that very few programmers understand lambda calculus (and
>>> this will not change), the word 'lambda' is equivalent to "too difficult to
>>> understand".
>>>
>>> When I looked up lambda on http://en.wikipedia.org/wiki/Lambda I read
>>>
>>>   In mathematical logic<http://en.wikipedia.org/wiki/Mathematical_logic>
>>>  and computer science <http://en.wikipedia.org/wiki/Computer_science>,
>>> lambda is used to introduce an anonymous function<http://en.wikipedia.org/wiki/Anonymous_function> expressed
>>> with the concepts of lambda calculus<http://en.wikipedia.org/wiki/Lambda_calculus>
>>> .
>>>
>>> and then "Oh that is what they meant with all that 'block-lambda' stuff".
>>>
>>> If the discussion here were on a new ES feature "anonymous methods",
>>>
>>
>>
>> Yep, though the main difference b/w "active blocks" (is this naming is
>> better than "block lambdas"?) is that by TCP, the block exits parent's
>> context, whereas "anonymous methods" return the the caller.
>>
>> So, there should semantic difference in discussions and explanations.
>> "Active blocks" is a good alternative to eliminate "lambda". However, of
>> course, more-less advanced programmer which want to know (and should know)
>> computer science concepts will go later deeper and will tackle with lambdas
>> again. And then she will say: "Oh, that is what they mean by action blocks
>> / anonymous methods".
>>
>> P.S.: small nit-pick,. from lambda calculus, the lambda is not necessary
>> anonymous. The lambda is just an _abstraction_ -- the basic encapsulation
>> block. Yes, it's a _function_ is the simplest view.
>>
>> Dmitry.
>>
>>
>>
>>> then I guess many more developers would be interested. If this feature
>>> had the properties outlined in the blog post, then I think many developers
>>> would understand the value of this potential feature. As it is I guess they
>>> stop reading as soon as they see the word 'lambda'.
>>>
>>> jjb
>>>
>>>
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120112/e1423aed/attachment.html>


More information about the es-discuss mailing list