Function syntax

Bob Nystrom rnystrom at google.com
Thu May 19 10:53:44 PDT 2011


On Thu, May 19, 2011 at 8:46 AM, David Griffiths <dxgriffiths at gmail.com>wrote:

> For all the talk about what's "usable" and "readable", I haven't seen much mention of empirical testing done with ordinary people... (My sincere apologies if there's some usability test lab for middlingly intelligent JavaScripters that I'm not aware of).
>
>
That data is out there in the context of C#. C# 2.0 used this syntax for
local functions:

  delegate(int x, int y) { return x + y; }

In C# 3.0, they added:

  (x, y) => x + y

Aside from the type annotations, those almost perfectly mirror the current
discussion for JS. A motivated person could do some archeology of open
source code to find out how much each is being used. I was doing a lot of C#
when 3.0 came out and watched a number of people learn the new syntax. It
generally went like:

1. Lambdas? Never heard of them.
2. What is this weird arrow thing? I don't like it.
3. Eh, I kind of understand what's going on, but it seems fishy.
4. Hey this is pretty terse.
5. OMG, working with collections is a breeze now! I just chained five maps
and filters!
6. How did I ever live without this?

- bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110519/bc390b12/attachment.html>


More information about the es-discuss mailing list