On Saturday, April 9, 2022 at 6:25:20 AM UTC+2, dxforth wrote:
> I recently began using a forth which did a .S (among other things) in QUIT.
> I previously considered such too verbose but have to say it's grown on me
> after intensive debugging involving spurious values on the stack. Some
> forths simply display DEPTH if non-zero which is akin to this teaser:
>
> "I've just picked up a fault in the AE35 unit. It's going to go 100% failure
> in 72 hours."
>
> No worries, Forth. I think I'll just ignore it :)
>
> Curious to know other forthers experiences/preferences?
Well, given that 4tH has a completely different architecture:
- When I'm testing stuff, I'm always adding either "DEPTH ." or ".S".
The former is a "builtin", so when I remove the "TOOLS" lib, I won't get
a compilation error;
- When writing serious application software (like in professional enviroments)
I'm almost always adding a check on "DEPTH" before leaving. If something is
left, it can have serious repercussions - so I wanna know. For end users, it's called
"system integrity" or "memory leak" - but that's not important right now;
- ABORT is the "get out of here!" command. It can't be caught. If you wanna
catch it, in 4tH you have to throw something. Hence, there is a THROW" as well.
In Gforth, there is now a small indication on what's left on the stack. In its current
form, it doesn't bother me too much. So far, it hasn't been really helpful either, but
that might change with one single occurrence. I do mostly porting work on Gforth,
so when something is wrong, it's usually in the differences between Gforth and
4tH.
When debugging 4tH, yes ".S" is my most intimate and most loyal friend. I only
see him when I invoke him, since 4tH does not have a prompt. But I would think
that even a friend like ".S" would become a nuisance if he dropped by uninvited.
For that, I'd prefer the presence of "DEPTH", I think.
Hans Bezemer