Open petetronic opened 1 year ago
Adding some color commentary:
We might hear about this situation soon-ish, because Positron currently can load a pre-existing .RData
, lying around from previous work in a project outside of Positron. And the user can obviously modify their global workspace within Positron. But currently Positron won't save the new workspace state back to .RData
, which is going to lead to a Groundhog Day experience (as in the movie) for anyone who hasn't adopted the "no .RData
save/reload ever!" lifestyle yet.
Reflecting on the bullets above which describe RStudio behaviour, I do wonder: do we really need all 4 combinations?
Load .RData
at startup
___________
no yes
Save .RData | no | A ?
on exit | yes | ? B
I live in state A and I know many people live in state B, though I think it's a bad idea.
But does anyone really live in the ?
states? They seem very weird to me.
I do think it would make sense to have a single "persist workspace" off/on toggle.
I also wonder if this should really be an R language pack feature, or if it should be a Positron-level feature that is implemented by language packs. i.e. if your lifestyle is "save my objects when I close so I can keep working on them when I open", I can't think of a reason that should be scoped to a particular language.
AFAIK there is no moral equivalent in Python, but it is not too hard to simulate w/ pickle
and/or shelve
. Notably Spyder (which is kind of an RStudio clone for Python) has its own .spydata
file format that appears to have been invented for the express purpose of creating a Python Save/Load Workspace experience.
I realized the table above is too simple, because "Save .RData
on exit?" can be yes, no, or ask.
Load .RData
at startup
___________
no yes
Save .RData | no | A ?
on exit | yes | ? B
| ask | ? C
I maintain that the ?
states are strange and think it's OK to not support them. The C
state does not appeal to me, but this is actually R's default behaviour, so lots of people must live this way.
Recap of what we should support:
A (Positron default): Do not persist the workspace:
R --no-restore-data --no-save
B: Always persist the workspace (--restore-data
is the default, so it's optional):
R --restore-data --save
C (base R default): Load .RData
if it exists; ask whether to save .RData
on exit:
R
A request was made to support the same options for .RData load/save that RStudio provides. That is, options to:
at the user level and at the workspace/folder/project level.