restoration of the input source specification on THROW

Reference

MAE/2

Author

M. Anton Ertl (anton@mips.complang.tuwien.ac.at)

Problem

The standard makes THROW responsible for restoring the input source specification. In combination with QUERY, this leads to the following anomaly:
: foo query 1 throw ;

: bar ['] foo catch ;

According to the standard, the 1 THROW should restore the input source specification in effect before the execution of CATCH. If FOO did not execute a THROW (or 0 THROW), then the input source specification should not be restored.

Proposal

Remove the requirement to restore the input source specification from the definition of THROW.

Add the following requirement to the definition of LOAD, INCLUDE-FILE, INCLUDED, EVALUATE etc.:

catch exceptions, restore the input source specification, and throw the exceptions.

Remarks

Alternatively, CATCH could be required to restore the input source specification, irrespective of whether there was a THROW or not. This would also eliminate the anomaly.

Experience

Most systems implementing THROW already implement the proposed behaviour. I have never heard of anyone complaining about that, neither from Gforth users nor otherwise. This indicates that no existing programs would be affected by the change.

AFAIK, there exist no experiences with the alternative.

Comments

Michael L. Gassanenko:
I agree. AFAIK, people (including myself) do implement CATCH and THROW without input souurce restoration, because if your program controls live hardware, why should you spend time and memory on >IN etc.?

Peter Knaggs:
The QUERY? word is defined as obsolescent and will be removed in the next revision of the standard. Moving the responsibility for input stream management to the input stream handling words would tend to make sense.