# How to avoid restart during development? [duplicate]

Possible Duplicate:
How do I clear all user defined symbols?

During package development things get messed up quite often. (especially when playing with notations)

Is there a simple way to reset MMA from within a notebook (Maple has "Restart")?

-

## marked as duplicate by belisarius, Mr.Wizard♦Oct 2 '12 at 16:22

If you use the Workbench you can run in Debug mode and then restarting the kernel is very convenient. Besides if you change definitions, add more code (or fix it) etc. the changes are immediately available - the workbench does the job for you. –  b.gatessucks Oct 2 '12 at 14:18
Within the notebook, just type Exit[]. –  Mark McClure Oct 2 '12 at 14:19
You may want to chek this question and answers therein. This probably won't help you with notation however. –  Leonid Shifrin Oct 2 '12 at 14:22
This is also related : mathematica.stackexchange.com/questions/850/… –  Artes Oct 2 '12 at 14:31
@b.gatessucks : THX, did not know about that fact. Tried the workbench again, works fine with code-changes. This is the way to go. –  NoEscape Oct 3 '12 at 9:50

How about Quit[]/Exit[], which kills the kernel?

-
There are also ways to save and reload state, but I doubt they'd work reliably if you are doing package development (and thus manipulating contexts), not to mention the notation stuff. –  acl Oct 2 '12 at 14:29

Like acl says, Quit[] kills the kernel, as does its synonym Exit[]. The complete internal state will be lost. When the MathKernel process isn't running, it is automatically restarted when you press Shift+Enter to evaluate an input line.

-
Your last sentence implies that the kernel is restarted every time an input line is executed. Did you mean to imply that? –  rcollyer Oct 2 '12 at 14:28
@rcollyer - er, no, obviously :-/. I fixed it. Thanks for the feedback. –  stevenvh Oct 2 '12 at 14:30
Thanks. Now you get, +1. –  rcollyer Oct 2 '12 at 14:31
So i still have to execute a cell containing Exit[], go to another cell containing <<"MyPackage" and some tests. Can this be shortened? Putting Exit[] and <<"MyPackage" in the same is not working. –  NoEscape Oct 2 '12 at 15:21
@NoEscape - The kernel will execute the input line left to right, so when it encounters Exit[], the kernel is killed, and then all other instructions from that input are lost. Same with the .m file. When you kill the kernel all you have left is the user interface, no execution of any kind. You could have the <<MyPackage on a separate input line. That input will be retained, but not automatically executed. So after you executed the Exit[] command, just select that line and press Shift+Enter –  stevenvh Oct 2 '12 at 15:33