Root prompt re-define value bug?


_ROOT Version:6.22.04
_Platform:mac OS X 10.15, ubuntu 18.04


re-define value with same name in prompt cause no warning nor bugs.
I’m not sure from with version cause this. but at least 6.22 has the problem.

root[000005]:> double a =2
(double) 2.0000000
root[000006]:> double a =1
(double) 1.0000000

Hi @cxwx1,
well spotted, that’s a recent feature, the interpreter now supports symbol redefinition. You can even do:

[ ] double a = 2.
[ ] int a = 42.

The motivation for the change in behavior is that it makes the interactive experience much less frustrating, especially in notebooks when you might want to re-execute certain code snippets (i.e. notebook cells) e.g. after fixing a typo.

Unfortunately I think there was an oversight and the feature has not been properly advertised in release notes or otherwise. We should definitely fix this. I opened https://sft.its.cern.ch/jira/browse/ROOT-10953 so we don’t forget.

Thank you very much for bringing this up!
Cheers,
Enrico