[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Draft with absence-thunks + clear

This page is part of the web mail archives of SRFI 44 from before July 7th, 2015. The new archives for SRFI 44 contain all messages, not just those from before July 7th, 2015.



A new draft is available at http://sgmiller.org/srfi-44.html.  It adds 
*-clear[![!]] and changes default values to thunks which are applied on 
absence of a value.  I prefer this to passing the arguments to the call 
again to the thunk, for a few reasons:

 - Thunks don't create additional lexical environments, and compilers 
   may more easily optimize simpler thunks such as (lambda () 
   'some-value).  They *feel* more efficient.
 - One can simulate a recall to the thunk with a small amount of code,  
   even if those arguments were other applications
   for example:

   (let ((tc (some-coll-producing-expr))
         (key (some-value-producing-expr))) 
    (dict-get tc key (lambda () ..tc and key both available here)))

  rather than
   (dict-get (some-coll-producing-expr)
             (some-value-producing-expr)
             (lambda (tc key) ... code ...))

 - It makes the signature of the procedure uniform across all 
   cases where an absence procedure is used, as opposed to 
   passing the args again, which can vary in number of arguments
   and type between collections and operators.

	Scott

Attachment: pgpz8K3nutNX3.pgp
Description: PGP signature