Skip to content

specifying name in the error message "promise already under evaluation"

1 message · Scott Kostyshak

#
Consider the following R code:

    abc <- function(x, y = y) {
      x + y
    }
    
    abc(x = 3)

which gives the following error:

    promise already under evaluation: recursive default argument
    reference or earlier problems?

If you google that error, you will find that it usually refers to the
situation given in the example above, although I'm sure the error is
more general and could be triggered in other situations.

I'm trying to think about how to improve the error for the most common
situation that triggers it. One simple way would be to give the name of
the promise. For example, I think that the following would already be an
improvement:

    promise "y" already under evaluation: recursive default argument
    reference or earlier problems?

Any thoughts?

Scott