BTF Measurements

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Mar 14 13:53:25 PDT 2012


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. 

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/72d5a5ad/attachment.html>


More information about the es-discuss mailing list