Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite recursion when inheriting from same class #282

Open
tdhock opened this issue Dec 12, 2023 · 0 comments
Open

infinite recursion when inheriting from same class #282

tdhock opened this issue Dec 12, 2023 · 0 comments

Comments

@tdhock
Copy link

tdhock commented Dec 12, 2023

hi, I made a mistake, accidentally specifying the class itself as inherit, which resulted in an infinite loop. I was surprised to see that is actually even allowed for the class definition:

> MyClass=R6::R6Class(inherit=MyClass)

I actually got no output (success) from the above line of code.
I would have expected/liked an error when running the above code, something like below:

> R6::R6Class(inherit=Undefined)$new()
Error in eval(inherit, parent_env, NULL) : object 'Undefined' not found

However I only got an error message later, shown below

> MyClass=R6::R6Class(inherit=MyClass)
> MyClass$new()
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

It was easy how to fix this issue, but it would have been even more obvious/user friendly if the error happens earlier (on R6Class definition), would that be possible please?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant