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


Groups > comp.lang.forth > #134739

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 17:53 +0000
Organization A noiseless patient Spider
Message-ID <10phd7h$u0pf$1@dont-email.me> (permalink)
References (1 earlier) <10pg7kg$gr82$1@dont-email.me> <69bbcf87$1@news.ausics.net> <10pgsie$nrtk$1@dont-email.me> <69bc21ec$1@news.ausics.net> <nnd$54c07bfc$1dc4a4c9@912bc05a634a75e5>

Show all headers | View raw


Hans Bezemer <the.beez.speaks@gmail.com> wrote:

> Now, remember that 4tH not only saves a location, but also a
> reference. E.g. the location of the "IF" is stored along with
> a reference "I am an IF!"
>
> Imagine what the control stack looks like when a "THEN" is
> encountered:
>
> DO    + location
> IF    + location
> LEAVE + location
>
> I cannot resolve the "IF" because "LEAVE" is TOCS.

This is where it gets interesting to me.  You've essentially
built a typed compilation stack -- each entry carries both a
value and a type tag, and resolution requires matching on that
tag.  Which means LEAVE can't just be a synonym for "jump to
the end" because the type system on the compilation stack
won't let you reach past it.

That's a real constraint and I think the right one.  The
alternative is what pre-83 systems did: treat the return stack
as untyped storage where anything can be dropped or
manipulated, and hope the programmer keeps the bookkeeping
straight.

> Of course, decreasing loops are in no way ANS-compliant

Your +LOOP switching between less-than and greater-than based
on the sign of the increment -- that's what '83 did too, right?
Or did ANS change the semantics?  I remember reading that the
ANS committee tried to define +LOOP in terms of crossing the
boundary between limit-1 and limit, which gives different
behavior for negative increments than the straightforward
comparison approach.

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