BTF Measurements

Rick Waldron waldron.rick at gmail.com
Wed Mar 14 14:26:26 PDT 2012


On Wed, Mar 14, 2012 at 4:53 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> On Mar 13, 2012, at 6:20 PM, Rick Waldron wrote:
>
> Kevin,
>
> Over the weekend I applied David Herman's new tri-lambda syntax to
> Popcorn.js to see how it would look and feel:
>
> https://github.com/rwldrn/popcorn-js/compare/tri-lambda
> ...
>
>
> So when I scan the diffs and my eye pass over pairs of changes like:
>
> -(function(global, document) {
>
> +((global, document) -> {
>
> or
>
> -          var DOMContentLoaded  = function() {
>
> +          let DOMContentLoaded = () -> {
>
> or
>
> -    Popcorn.p[ api ] = function() {
>
> +    Popcorn.p[ api ] = () -> {
>
> or
>
> -    script.addEventListener( "load",  function() {
>
> +    script.addEventListener( "load", () -> {
>
>
> my eyes invariably go to the first line of each pair and I have a minor
> mental WTF moment when I look at the second line. Now some of this is no
> doubt a matter of familiarity, but does anyone really think that the second
> forms are more readable even with experience.  At least in western
> cultures, are brains are trained from a early age to recognize meaning in
> words. Symbols are far less common and symbol semantically meaningful
> symbol sequences are even rarer.
>

By the time I was about a quarter of the way through making these changes,
the "function() {..." starting looking and feeling like the syntax that was
out of place. My instinct was to "seek and destroy", replacing them with
the much simpler syntax and it felt satisfying and enjoyable to do so.

Technical and grammatical point aside, I really enjoyed writing this code.


Rick



>
> In what way does this syntax help people read and understand code?
>
> Allen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120314/3378f046/attachment.html>


More information about the es-discuss mailing list