Opened 14 years ago
Closed 14 years ago
#103 closed proposed feature (wontfix)
exit should return from a proc to Toplevel
Reported by: | Owned by: | hannes | |
---|---|---|---|
Priority: | minor | Milestone: | Release 3-1-0 |
Component: | singular-kernel | Version: | |
Keywords: | behaviour of exit | Cc: |
Description
gorzel wrote in Ticket #100
>> It would have been easier to extend the already existing command "exit".
hannes wrote
> no exit and ERROR are very diffrent. > In principle, ERROR is an runtime error.Yes, but I would like to have a command that leaves a proc from inside, without going through the internal error-machinery.
Compare with the command break; which can be used to leave a loop.
As quit; and exit; behave the same: they leave Singular entirely, I suggest to change the exit in the following way:
When exit is called from inside a proc,
it should leave the proc and return silently to the Toplevel,
when called on the Toplevel, it may leave Singular entirely.
The command quit; shall stay as it is and always leave Singular, but
the behaviour of exit; should depend on the level from which it is called.
(Additionally, exit may have a string as argument, that it displays, (compare with exit in my-sql) and this could then serve as the ERROR command. This is what I had in mind, when writing
It would have been easier to extend the already existing command "exit".)
if this exit should be like an error, use ERROR. If not: what to do if called inside a proc, which should return a value? This may also be indirect: exit called within proc which was called inside a proc, which should return a value etc.