Re: [Rd] Capturing environment associated with a promise

From: Gabor Grothendieck <>
Date: Mon, 08 Oct 2012 11:23:57 -0400

On Mon, Oct 8, 2012 at 9:22 AM, Hadley Wickham <> wrote:
> Hi all,
> It's possible to capture the expression associated with a promise
> (using substitute). Is there any way to capture the environment
> associated with a promise? Similarly, is there any way to tell if
> something is a promise without accidentally evaluating it?

Both of these are possible in C. See:

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.

Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at

______________________________________________ mailing list
Received on Mon 08 Oct 2012 - 15:27:53 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 10 Oct 2012 - 09:00:45 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive