Sujet : Re: Parsing timestamps?
De : zbigniew2011 (at) *nospam* gmail.com (LIT)
Groupes : comp.lang.forthDate : 10. Jun 2025, 11:10:33
Autres entêtes
Organisation : novaBBS
Message-ID : <1b4831f52660397661e363561380d23d@www.novabbs.com>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Rocksolid Light
Stack jugglery means wasting CPU cycles for
moving the bytes around - it's contrproductive.
Variables have been invented to be used. They're
useful, if you didn't notice, or if they didn't
tell you that in your college, or wherever.
>
Forth uses variables in the global sense and this works well.
Variables at the word level is often an indication something is
wrong. Locals users rarely justify on grounds of performance as
experience over the years has shown time and again well-written
stack code is both shorter and faster.
Maybe, but:
- it had to be well-written
- at some point (I mean after 'critical' amount of ROTs, DUPs
and SWAPs has been reached) it becomes unreadable - and after
longer time unmanageable, if you'd like to modify it later.
Or at least difficult to manage
What I learned is to use these stack-related words to
set the bytes in proper order - but to avoid the constant
threshing bytes at the stack, as counterproductive. What is
the result of ROTs, DUPs and SWAPs? The bytes in different
order (and probably their count may vary). Nothing more.
The CPU time taken for all that is wasted time. Your program
did nothing really useful.
So although I'm of course not opposed to use these words
when needed, the key is to recognize 'do I really need to
do it this way?'. And when cleaner solution can be applied
- like using a variable or two instead - then the kind
of 'ideological stance' (like "the canonical Forth programs
require...") doesn't make much sense.
--