pmonks / for-science

A small Discord bot that you can send Clojure code to, to experiment with the language, demonstrate core language principles, or just mess about.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decide whether to keep interpreter state around between invocation, and if so for how long

pmonks opened this issue · comments

The "if so how long" part is especially important, to prevent memory leaks. My initial thought is that this could be based on an inactivity period e.g. after X minutes of inactivity, the interpreter is reset.

Very keen for others to weigh in on this!

I'm not sure how long to keep it active for but maybe 5 minutes is a decent default. I also think some sort of means to persist source code or a session to be reloaded would be nice. Maybe via pinning a message or something else that would store the source code on the discord server using the bot.

@E-A-Griffin regarding persisting interpreter state - the bigger question is whether this is useful enough to bother implementing (however it's done). Do you have a use case where the current approach doesn't work, and preserving interpreter state would be the best solution?

Regarding persisting the source code - this would probably be better discussed in a different issue, if you're open to creating one?