From h.wickham at gmail.com  Tue Oct  9 17:58:35 2012
From: h.wickham at gmail.com (Hadley Wickham)
Date: Tue, 9 Oct 2012 10:58:35 -0500
Subject: [Rd] Capturing environment associated with a promise
In-Reply-To: <CAP01uR=x1SdWNZ+8c2=Prynm18om7yq0_u_Rf9UuAVFUA_zNwg@mail.gmail.com>
References: <CABdHhvHGm8qABh7XWeMNCA9qLUFEf1ksJaf0NDH_xhyHK=jtpw@mail.gmail.com>
	<CAP01uR=x1SdWNZ+8c2=Prynm18om7yq0_u_Rf9UuAVFUA_zNwg@mail.gmail.com>
Message-ID: <CABdHhvGs62RRL8ky8hgZjvASLsXT8NA1EAZiJM2gzgt1R_1wGQ@mail.gmail.com>

> Both of these are possible in C. See:
>
> https://stat.ethz.ch/pipermail/r-devel/2007-September/046943.html

Cool, thanks.

> It shows how to query an object to see if its a promise and but rather
> than extract the environment it shows how to copy a promise without
> evaluating it; however, it was also my experience that these two were
> what was actually needed rather than being able to extract the
> environment.
>
> I would also recommend you do some testing since I found that adding
> promises did not always make as big a difference in performance as I
> had hoped and the added complexity may not be worth it in all cases.
> For example, I had a version of proto that supported promises but
> ggplot2 only ran slightly faster with it so I did not pursue it any
> further.  On the other hand if you are doing it to support
> self-referential structures then that is a different matter.

I'm mainly interested in this for pedagogy - giving students some
tools to inspect promises without evaluating them would be useful.

Hadley

-- 
RStudio / Rice University
http://had.co.nz/



[Rd] Capturing environment associated with a promise
Hadley Wickham