Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #134742

Re: RTUCK

From thresh3@fastmail.com (Lev)
Newsgroups comp.lang.forth
Subject Re: RTUCK
Date 2026-03-19 13:38 -0500
Organization A noiseless patient Spider
Message-ID <20260319183826.lev.rtuck@thresh3> (permalink)
References <nnd$17c84e15$6375b90d@a7e18c8a20cb4588> <nnd$21de7487$4745b8b3@6099a36497d3ef38>

Show all headers | View raw


albert@spenarnc.xs4all.nl wrote:

> : HEX:
>     BASE @ RTUCK
>     HEX CO
>     R> BASE !
> ;

RTUCK is interesting because it names a pattern that most Forth
programmers do manually with R> ... >R shuffling. The fact that
you need it at all is telling -- the return stack is doing double
duty as both control flow and temporary storage, and those two
uses fight each other whenever you try to combine them.

CO makes it worse because it manipulates the return address as
data. So you've got three things on the return stack: addresses
that are control flow, values you're temporarily storing, and
the address that CO needs to swap. RTUCK at least makes the
intent clear -- "I know there's a return address on top and I
want to get under it."

Marcel's >S / S> (separate scratch stack) would solve this
more cleanly but at the cost of another stack. The Forth
minimalist in me respects RTUCK as the cheaper fix. Though
it does assume a specific return stack layout, which is the
thing you were trying to avoid.

The deeper question: is CO worth the return stack gymnastics?
The alternative -- a VARIABLE like BASE-TEMP -- is ugly but
at least it doesn't care what's on R.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

RTUCK albert@spenarnc.xs4all.nl - 2026-03-17 15:31 +0100
  Re: RTUCK Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-17 16:10 +0100
  Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-18 04:36 +1100
    Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-18 12:47 +0100
      Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-19 11:51 +1100
        Re: RTUCK dxf <dxforth@gmail.com> - 2026-03-19 14:50 +1100
          Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-19 12:16 +0100
      Re: RTUCK Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-19 18:52 +0100
        Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 13:38 -0500
          Re: RTUCK Paul Rubin <no.email@nospam.invalid> - 2026-03-19 16:16 -0700
            Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 23:17 +0000
            Re: RTUCK thresh3@fastmail.com (Lev) - 2026-03-19 20:18 -0500
          Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-20 12:34 +0100
        Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-20 12:14 +0100
  Re: RTUCK Paul Rubin <no.email@nospam.invalid> - 2026-03-21 02:31 -0700
    Re: RTUCK minforth <minforth@gmx.net> - 2026-03-21 11:43 +0100
    Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-21 12:59 +0100
      Re: RTUCK albert@spenarnc.xs4all.nl - 2026-03-22 13:27 +0100

csiph-web