Mark global variables automatically as const #2462
-
There was a somewhat recent issue about performance loss triggered by repeated access to a global variable: #2348 (comment) Of course the observant programmer can avoid this issue but it can happen quite easily. One way to fix this performance is marking the global variable Here is the idea: Pluto could mark all global variable In my mind, this has the benefit of closing a performance trap once and for all with no downsides and could be easy to implement. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think this was not done at least in part because declaring variables as I seem to remember @fonsp telling at some point that if you have a const variable it can't be deleted this way |
Beta Was this translation helpful? Give feedback.
I think this was not done at least in part because declaring variables as
const
prevents them from being deleted/garbage collected when they are removed from the notebook. Pluto deals with adding and removing variables by creating a new module at each execution and eventually deleting all variable from previous modules if they are not in the notebook anymore.I seem to remember @fonsp telling at some point that if you have a const variable it can't be deleted this way