Skip to content
Prev 15385 / 63424 Next

delay() has been deprecated for 2.1.0

On Sat, 12 Mar 2005 Mark.Bravington@csiro.au wrote:

            
Relying on undocumented features when designing a package is not a
good idea.  In this case the feature of env$x returning a promise
contradicts the documentation and is therefore a bug (the
documentation says that env$x should behave like the corresponding
get() expression, and that forcec promises and returns their values).
This would not be a good idea.  The current behavior of leaving an
evaluated promise in place is also not a documented feature as far as
I can see.  It is a convenient way of implementing lazy evaluation in
an interpreter but it has drawbacks.  One is the cost of the extra
dereference.  Another is the fact that these promises keep alive their
environments that might otherwise be inaccessible and hence available
for GC.  These environments might in turn reference large data
structures, keeping them alive.  At this point it seems too complicated
to deal with this in the interpreter, but a compiler might be able to
prove that a promise can be safely discarded.  (In fact a compiler
might be able to prove that a promise is not needed in the first
place).

There are other possible approaches that you might use, such as active
bindings (see the help for makeActiveBinding).  If that won't do we
can look into developing a suitable abstraction that we can implement
and document in a way that does not tie the hands of the internal
implementation.

Best,

luke