I love how Javascript libraries like JQuery require people to use thunks all over the place:

 $(document).ready(function() {
   $("#orderedlist li:last").hover(function() {
     $(this).addClass("green");
   },function(){
     $(this).removeClass("green");
   });
 });

The functions without parameters are called thunks and their purpose is to delay the evaluation of the code in argument positions, circumventing standard applicative order evaluation. Here's hoping that future languages--even future versions of Javascript--take this need into account and add real linguistic features for delayed evaluation. Oh wait--Lisp already does and it's only 50 years old.


Please leave comments using the Hypothes.is sidebar.

Last modified: Thu Oct 10 12:47:18 2019.