Curious to know other forthers experiences/preferences?
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?
dxforth <dxf...@gmail.com> writes:
Curious to know other forthers experiences/preferences?The development version of Gforth diplays the stack depth after ok,
and the stack contents in the bottom line (which is erased when
the next line is text-interpreted).
E.g., inputting
s" foo" 1.23e
results in a line
s" foo" 1.23e ok 2 f:1
(2 is the data stack depth, 1 the FP stack depth), and the bottom line shows:
<2> "foo" |F:<1> 1.230000E0 |o:Forth Forth Root Forth
The <2> "foo" is interesting. I guess that it appears only when the 2nd stack element
points to a stack buffer.
What happens when you input "foo" at the command line?
This will print the stack items and clear the stack. A very useful tool
"minf...@arcor.de" <minf...@arcor.de> writes:
The <2> "foo" is interesting. I guess that it appears only when the 2nd stack elementThis comes out of "...", the smart brother of ".S" <2019Apr3...@mips.complang.tuwien.ac.at>. It uses some heuritics
points to a stack buffer.
to try to guess what the stack items mean. Often it is right,
sometimes it is wrong. I would have to look at the code to find out
what the exact heuristics are, but it's probably something like: the
length part must be not too big, all bytes inside accessible, and they
must not be control characters.
What happens when you input "foo" at the command line?"foo" type \ foo ok
The stuff behind \ is the output.
The general principle is that ... outputs stuff in a way that you can
also input. So we have recognizers for these things. E.g.:
create a 10 allot
a 1 + ... \ <1> <a+$1> ok 1
<a+$1> = . \ -1 ok
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
Anton Ertl schrieb am Samstag, 9. April 2022 um 18:01:01 UTC+2:
create a 10 allot
a 1 + ... \ <1> <a+$1> ok 1
<a+$1> = . \ -1 ok
So <a+$1> is infix while Forth is postfix ... if it helps debugging, okay.
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?
I think it's a question of taste.
FORTH> : test begin 123 56 >S PI QUIT AGAIN ; ok
FORTH> test
[1]<1>{1}FORTH> . -s f. 123 3.141593 ok
-marcel
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I usually alias it to "cs" when testing stuff.That's fine. "cs" is a little more awkward than ".." but will do. For sure ".." is for at the terminal
S Jack <sdwjack69@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I usually alias it to "cs" when testing stuff.
On 10/04/2022 04:32, Paul Rubin wrote:
S Jack <sdwj...@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I usually alias it to "cs" when testing stuff.ABORT clears the stack without an error msg. Error msg or not I'm puzzled
why another word is necessary. It's a rare app that needs it and trivial enough to define when one does.
dxforth schrieb am Sonntag, 10. April 2022 um 20:42:43 UTC+2:
On 10/04/2022 04:32, Paul Rubin wrote:
S Jack <sdwj...@gmail.com> writes:ABORT clears the stack without an error msg. Error msg or not I'm puzzled
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I
usually alias it to "cs" when testing stuff.
why another word is necessary. It's a rare app that needs it and trivial
enough to define when one does.
"clearstack" is only a factor of ABORT.
They are not equivalent.
I've been unable to make a case for factoring 'clearstack'
dxforth <dxforth@gmail.com> writes:
I've been unable to make a case for factoring 'clearstack'
Checking this in Gforth:
CLEARSTACK (data stack) is only called from CLEARSTACKS (data and FP
stack) CLEARSTACKS is only called from QUIT. I have also looked at
uses of SP! and FP! to see whether there were additional factoring opportunities, but there are not.
So it's more a conceptual thing: When I want to clear the stacks, I
write CLEARSTACKS. When I want to abort, I write ABORT (but I never
want to do that; instead, I throw).
On 11/04/2022 06:46, minf...@arcor.de wrote:
dxforth schrieb am Sonntag, 10. April 2022 um 20:42:43 UTC+2:
On 10/04/2022 04:32, Paul Rubin wrote:
S Jack <sdwj...@gmail.com> writes:ABORT clears the stack without an error msg. Error msg or not I'm puzzled >> why another word is necessary. It's a rare app that needs it and trivial >> enough to define when one does.
In Fig days and before Linux it was common and convenient to hit dotIn gforth (and maybe it is in ANS) "clearstack" clears the stack, and I >> > usually alias it to "cs" when testing stuff.
twice for an illegal command to clear the stack. That quickly evolved >> >> to the word ".." that would clear the stack without an error message. >> >
"clearstack" is only a factor of ABORT.I've been unable to make a case for factoring 'clearstack' - other than
They are not equivalent.
for systems where ABORT doesn't clear the stacks. One could point to
forth standards and say they've not seen fit to distinguish them either.
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?
On 9/04/2022 21:06, Marcel Hendrix wrote:[..]
On Saturday, April 9, 2022 at 6:25:20 AM UTC+2, dxforth wrote:
It's beneficial to automatically see the results of operations at each step - much the same way as a calculator or debugger does:
S Jack <sdwjack69@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I >usually alias it to "cs" when testing stuff.
dxforth <dxforth@gmail.com> writes:
I've been unable to make a case for factoring 'clearstack'
Checking this in Gforth:
CLEARSTACK (data stack) is only called from CLEARSTACKS (data and FP
stack) CLEARSTACKS is only called from QUIT. I have also looked at
uses of SP! and FP! to see whether there were additional factoring >opportunities, but there are not.
So it's more a conceptual thing: When I want to clear the stacks, I
write CLEARSTACKS. When I want to abort, I write ABORT (but I never
want to do that; instead, I throw).
- anton
S Jack <sdwjack69@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I
usually alias it to "cs" when testing stuff.
ABORT clears the stack without an error msg. Error msg or not I'm puzzled >why another word is necessary. It's a rare app that needs it and trivial >enough to define when one does.
In article <87lewe9...@nightsong.com>,
Paul Rubin <no.e...@nospam.invalid> wrote:
S Jack <sdwj...@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved
to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I >usually alias it to "cs" when testing stuff.cs is a little bit to terse.
I would like to see CLS make into the standard.
Every Forth is defining a new word with this functionality.
I ought to be in the standard.
It's beneficial to automatically see the results of operations at each step - much the same way as a calculator or debugger does:
1 2 3 ok 1 2 3 <
+ ok 1 5 <
- ok -4 <
. -4 ok
pi ok 3.141593E0 <f
2e f* ok 6.283186E0 <f
For my taste CLS is too close to that old CLearScreen.
I use .. quite often and like it because it is just a quick double-tap
on the keyboard adjacent to the space bar.
On Sunday, April 10, 2022 at 6:12:21 AM UTC+2, dxforth wrote:
On 9/04/2022 21:06, Marcel Hendrix wrote:[..]
On Saturday, April 9, 2022 at 6:25:20 AM UTC+2, dxforth wrote:
It's beneficial to automatically see the results of operations at each step -
much the same way as a calculator or debugger does:
FORTH> : ok .S ; ok
FORTH> 1 2 3 ok
Data: 1 2 3 ---
System: ---
Float: --- ok
[3]FORTH> + ok
Data: 1 5 ---
System: ---
Float: --- ok
[2]FORTH> - ok
Data: -4 ---
System: ---
Float: --- ok
[1]FORTH> . -4 ok
FORTH> pi ok
Data: ---
System: ---
Float: 3.1415926535897932385 --- ok
{1}FORTH> 2e f* ok
Data: ---
System: ---
Float: 6.2831853071795864770 --- ok
{1}FORTH> f. 6.283185 ok
Like this?
In article <t2v8f0$1h8t$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
On 10/04/2022 04:32, Paul Rubin wrote:
S Jack <sdwjack69@gmail.com> writes:
In Fig days and before Linux it was common and convenient to hit dot
twice for an illegal command to clear the stack. That quickly evolved >>>> to the word ".." that would clear the stack without an error message.
In gforth (and maybe it is in ANS) "clearstack" clears the stack, and I
usually alias it to "cs" when testing stuff.
ABORT clears the stack without an error msg. Error msg or not I'm puzzled >>why another word is necessary. It's a rare app that needs it and trivial >>enough to define when one does.
You must be kidding. Teach a Forth novice to clear the stack by invoking
a scary word like ABORT ? .
Better declare ABORT obsolescent because
it lacks clear intent, and the suggestion that it may be equivalent
to a throw makes my head spin.
Also ABORT doesn't work in a definition to clear the stack.
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.
I recently began using a forth which did a .S (among other things) in QUIT.Well, given that 4tH has a completely different architecture:
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?
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.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 39:49:36 |
Calls: | 6,708 |
Calls today: | 1 |
Files: | 12,241 |
Messages: | 5,353,645 |