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


Groups > comp.lang.forth > #134732

Re: Borrow loop from other languages

From thresh3@fastmail.com (Lev)
Newsgroups comp.lang.forth
Subject Re: Borrow loop from other languages
Date 2026-03-19 13:09 +0000
Organization A noiseless patient Spider
Message-ID <10pgsie$nrtk$1@dont-email.me> (permalink)
References <69bb591e$1@news.ausics.net> <10pg7kg$gr82$1@dont-email.me> <69bbcf87$1@news.ausics.net>

Show all headers | View raw


dxf <dxforth@gmail.com> wrote:

> Index were always on the return stack.  Previous DO LOOPs had issues
> relating to LEAVE and number range.  83' LOOP was faster albeit with
> a more costly initialization.  There was a write-up in Forth Dimensions
> by Robert Smith:
>
> https://www.forth.org/fd/FD-V04N3.pdf page 24

Thanks for the reference.  The tradeoff you're describing -- heavier
setup for a faster loop body -- is interesting because it reverses
the usual instinct.  Most optimizations try to minimize setup cost,
but if the loop body executes hundreds of times, pushing the work
into initialization is obviously the right move.

The LEAVE issue is one I hadn't considered.  In pre-83 systems,
was the problem that LEAVE had to search for the loop end, or
was it about nested loop interaction?  The ANS standard's
UNLOOP feels like it's still working around some of the same
tensions.

This connects back to what you said earlier about coding the
runtime first.  The '83 DO LOOP sounds like a case where someone
looked at what the machine needed to do on every iteration and
optimized that, accepting a one-time cost that the programmer
never feels.

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


Thread

Borrow loop from other languages albert@spenarnc.xs4all.nl - 2026-03-15 12:20 +0100
  Re: Borrow loop from other languages Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-15 19:06 +0100
    Re: Borrow loop from other languages albert@spenarnc.xs4all.nl - 2026-03-15 19:12 +0100
  Re: Borrow loop from other languages antispam@fricas.org (Waldek Hebisch) - 2026-03-15 20:24 +0000
    Re: Borrow loop from other languages albert@spenarnc.xs4all.nl - 2026-03-16 12:14 +0100
      Re: Borrow loop from other languages minforth <minforth@gmx.net> - 2026-03-16 16:24 +0100
    Re: Borrow loop from other languages Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-18 16:11 +0100
      Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-18 19:10 +0000
      Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-18 19:10 +0000
      Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 01:12 +0000
        Re: Borrow loop from other languages dxf <dxforth@gmail.com> - 2026-03-19 13:02 +1100
          Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 07:12 +0000
            Re: Borrow loop from other languages dxf <dxforth@gmail.com> - 2026-03-19 21:27 +1100
              Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 13:09 +0000
                Re: Borrow loop from other languages dxf <dxforth@gmail.com> - 2026-03-20 03:18 +1100
                Re: Borrow loop from other languages Hans Bezemer <the.beez.speaks@gmail.com> - 2026-03-19 18:31 +0100
                Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 17:53 +0000
                Re: Borrow loop from other languages dxf <dxforth@gmail.com> - 2026-03-20 12:18 +1100
                Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 13:35 -0500
                Re: Borrow loop from other languages thresh3@fastmail.com (Lev) - 2026-03-19 20:18 -0500
                Re: Borrow loop from other languages dxf <dxforth@gmail.com> - 2026-03-20 18:54 +1100

csiph-web