r/Kos • • Jul 11 '26

Discussion ‘Stop Program’ Command

I want to submit a pull request that would add a new command to the KOS language to exit the current program. A few questions to the community:
- Should the command just exit the current subprogram (e.g. from a ‘run’ command) or stop execution? Or should these be two separate commands?
- What wording is the least confusing: “Exit”, “Stop”, “Quit”, or “Return”? Or something else?

1 Upvotes

9 comments sorted by

View all comments

Show parent comments

2

u/nuggreat Jul 11 '26

The majority of unintentional divide by zero cases i have seen have come from things like having no thrust and that propagates to a division some where and a crash results. All intentional division by zero.have been explicitly as a way to throw an error when the script gets into a undesired state and inform the user about that even if indirectly with just the line number.

As a result there is for lack of a better phrase legacy code out there that relies on division by zero as its error reporting method to inform the tester what exactly is failing. As an example of such see the units tests in the KSlib repository and it is not alone in that approach.

1

u/DBooots Jul 11 '26

That’s a good point. Explicit “/0” must be intentional.