Sujet : Re: Parsing timestamps?
De : no.email (at) *nospam* nospam.invalid (Paul Rubin)
Groupes : comp.lang.forthDate : 30. Jun 2025, 10:44:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87frfhzhq4.fsf@nightsong.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
zbigniew2011@gmail.com (LIT) writes:
"Pick and Roll are the generic operators which treat the data stack as
an array. If you find you need to use them, you are probably doing it
wrong. Look for ways to refactor your code to be simpler instead."
What is the origin of that quote? PICK treats the stack like an array,
but ROLL treats it more as a circular shift register.
Most CPUs these days have a register file, which is essentially an array
with only immediate-like addressing mode. Presumably that design
evolved because programmers found it useful.
PICK afaict is mostly used with literal offsets as well. Having a
variable offset is suspicious.
: 3DUP ( a b c -- a b c a b c ) 3 PICK 3 PICK 3 PICK ;
Seems clearer than some mess of ROT and return stack temporaries.