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


Groups > comp.lang.forth > #9864 > unrolled thread

In Forth, is it valid or safe to use the value of 'I' after LOOP?

Started by"Rod Pemberton" <do_not_have@noavailemail.cmm>
First post2012-03-05 16:23 -0500
Last post2012-03-14 20:13 -0400
Articles 20 on this page of 102 — 20 participants

Back to article view | Back to comp.lang.forth


Contents

  In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-05 16:23 -0500
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-05 12:11 -1000
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-05 13:44 -1000
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 11:26 +0000
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-06 05:42 -0800
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 14:51 +0000
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-06 10:17 -0600
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 16:49 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-06 11:56 -0600
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-06 18:07 +0000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-07 04:14 -0600
                        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 15:56 +0000
                          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 11:23 -0500
                            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:26 +0000
                              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 12:28 -0500
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 13:36 -0500
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 09:18 -1000
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-06 20:14 -0800
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 08:22 -0800
                        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-07 10:20 -0800
                          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 11:11 -0800
                        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-07 19:07 -0800
                          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-08 10:11 -0800
                          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 09:36 +0000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:01 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Alex McDonald <blog@rivadpm.com> - 2012-03-06 13:13 -0800
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 16:04 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-12 13:40 -0700
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-07 10:15 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 10:33 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-07 17:16 -1000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-03-12 11:18 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 08:01 -1000
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 18:59 -0700
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-16 20:36 +0100
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 13:33 -0500
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 09:07 -1000
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-06 18:20 -0500
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 14:07 -1000
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? John Passaniti <john.passaniti@gmail.com> - 2012-03-06 16:53 -0800
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-06 19:26 -1000
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-10 19:04 -0500
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-10 18:44 -0800
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:06 -0400
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:01 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-03-11 12:51 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 14:04 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-11 14:41 -0700
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-12 05:16 -0500
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-12 08:06 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-03-11 21:55 +0000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:17 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-12 11:00 +0000
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-11 17:27 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-11 14:12 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-11 21:48 +0000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 14:24 -1000
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:09 -0700
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-11 17:34 -0400
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-11 13:18 -1000
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-11 17:32 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Josh Grams <josh@qualdan.com> - 2012-03-13 13:18 +0000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-19 03:36 -0400
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:37 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-16 05:31 -0700
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-19 03:38 -0400
                        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-19 11:35 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-16 20:39 +0100
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-12 12:50 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:27 -0700
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-07 08:16 -0800
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? jacko <jackokring@gmail.com> - 2012-03-15 19:09 -0700
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? rickman <gnuarm@gmail.com> - 2012-03-05 14:23 -0800
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? BruceMcF <agila61@netscape.net> - 2012-03-05 17:42 -0800
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-06 09:36 -0800
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-08 10:41 +0000
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-08 05:38 -0800
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? hwfwguy@gmail.com - 2012-03-09 10:32 -0800
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-12 19:26 -0700
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 04:15 -0400
    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Coos Haak <chforth@hccnet.nl> - 2012-03-12 01:11 +0100
      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-12 19:41 -0400
        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-12 16:46 -1000
          Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-12 21:17 -0700
            Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 05:01 -0400
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 03:06 -0700
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-13 12:32 -0700
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-03-13 14:01 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Paul Rubin <no.email@nospam.invalid> - 2012-03-14 11:47 -0700
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 22:13 +0100
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-03-14 03:39 -0500
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-14 06:54 -1000
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-14 16:39 -0700
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-03-15 10:49 +0000
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Alex McDonald <blog@rivadpm.com> - 2012-03-14 08:53 -0700
                    Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 17:01 +0100
                      Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? George Hubert <georgeahubert@yahoo.co.uk> - 2012-03-14 11:21 -0700
                        Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "A. K." <akk@nospam.org> - 2012-03-14 19:25 +0100
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-03-14 16:37 -0700
                  Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:28 -0400
              Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "David N. Williams" <williams@umich.edu> - 2012-03-13 16:19 -0400
                Re: In Forth, is it valid or safe to use the value of 'I' after LOOP? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-14 20:13 -0400

Page 1 of 6  [1] 2 3 4 5 6  Next page →


#9864 — In Forth, is it valid or safe to use the value of 'I' after LOOP?

From"Rod Pemberton" <do_not_have@noavailemail.cmm>
Date2012-03-05 16:23 -0500
SubjectIn Forth, is it valid or safe to use the value of 'I' after LOOP?
Message-ID<jj3ats$bsb$1@speranza.aioe.org>
In Forth, is it valid or safe to use the value of 'I' after LOOP?

e.g., I need the termination value of the DO-LOOP at <x>:

: some_def ... DO ... I ... LOOP <x> ... ;

However, I'm not sure if it is valid and safe to use the termination value
of 'I' there, like it would be in C.  My suspicion is: "No".  Use of a loop
variable just after the loop,  IIRC ... , is common for other languages.
How does Forth handle this?

fig-Forth says other use of 'I', i.e., that outside a loop, is
implementation dependent.

ANS says an ambiguous condition exists if the loop control parameters are
unvailable, but it doesn't state the loop control parameters are prohibited
from use outside a loop.

Is it normal or rare in Forth that I is available after LOOP?

Also, why does fig-Forth require ." in interactive mode, but ANS doesn't?


Rod Pemberton

WORDS
WORDS 'LAST TRACE ID. ? LINK> NAME> BODY> >LINK >NAME
>BODY ." (.") FILL ] [ CHAR LITERAL TYPE SPACES SPACE ALIGN
ALIGNED CR VARIABLE CONSTANT CREATE DOES> ' ?DUP LOOP
DO (LOOP) (DO) I UNTIL AGAIN BEGIN ELSE THEN IF NEGATE
INVERT 1- 1+ C, ALLOT +! HERE CHARS CELLS CHAR+ CELL+
TAKE NUP DIP DRIP -ROT TUCK NIP ROT OVER SWAP DROP DUP
NOT TRUE FALSE SMUDGE ( IMMEDIATE B! B@ A! A@ nbSMDG
nbPREC nbSIGN COLD ABORT QUIT INTERPRET ; : (CREATE) WORD
QUERY COMPILE , 0BRANCH BRANCH TOGGLE OK XDUMP
COMPARE COUNT CMOVE C! C@ EMIT KEY 0<> 0> 0< 0= < > <> =
NUMBER - XOR OR AND EXECUTE FIND ENCLOSE TRIM EXPECT
BYE LATEST +ofsPTR +ofsDLS +ofsPFA +ofsCFA +ofsNFA +ofsLFA
szCELL szBYTE TIB NL LF BL LX IX STATE BLK IN RP0 SP0 RP SP
DP0 DP LAST B A LIT . + ! @ R@ R> >R DODOES DOVAR ENTER EXIT

There are some bugs, but it is coming along nicely now.


[toc] | [next] | [standalone]


#9865

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-03-05 12:11 -1000
Message-ID<1KGdnU2taaxgpMjSnZ2dnUVZ_hGdnZ2d@supernews.com>
In reply to#9864
On 3/5/12 11:23 AM, Rod Pemberton wrote:
> In Forth, is it valid or safe to use the value of 'I' after LOOP?
>
> e.g., I need the termination value of the DO-LOOP at<x>:
>
> : some_def ... DO ... I ... LOOP<x>  ... ;

If you push I on the stack every iteration, you'll have a whole bunch of 
them by the time the loop ends!

> However, I'm not sure if it is valid and safe to use the termination value
> of 'I' there, like it would be in C.  My suspicion is: "No".  Use of a loop
> variable just after the loop,  IIRC ... , is common for other languages.
> How does Forth handle this?

I isn't a "variable" it's a word that pushes a *copy* of the current 
value of the loop counter onto the stack when it is executed. Once on 
the stack, it's like any other stack item, to use as you see fit.

The loop counter itself doesn't *exist* outside the loop, in any Forth 
that I know of.

Consider this example:

: foo ( n1 -- n2 )   100 0 DO  [some test] IF DROP I LEAVE THEN LOOP ;

Here you'll end up with either the original n1 on the stack or the value 
of I when the test succeeded. That value is a perfectly normal value, 
and once it was pushed onto the stack the fact that it was the value of 
the loop counter at that time doesn't affect the fact that it's a 
perfectly normal stack item now.

> fig-Forth says other use of 'I', i.e., that outside a loop, is
> implementation dependent.
>
> ANS says an ambiguous condition exists if the loop control parameters are
> unvailable, but it doesn't state the loop control parameters are prohibited
> from use outside a loop.
>
> Is it normal or rare in Forth that I is available after LOOP?
>
> Also, why does fig-Forth require ." in interactive mode, but ANS doesn't?

I can't answer for fig-forth. It was a long, long time ago.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#9869

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-03-05 13:44 -1000
Message-ID<N4mdnTCIPKJI0sjSnZ2dnUVZ_rqdnZ2d@supernews.com>
In reply to#9865
On 3/5/12 12:11 PM, Elizabeth D. Rather wrote:
> fig-Forth says other use of 'I', i.e., that outside a loop, is
> implementation dependent.

I suddenly realize what that statement is trying to say:  in early 
Forths, the loop parameters were *always* on the Return Stack. So, some 
people used I outside a loop to get a copy of whatever is on the Return 
Stack (equivalent to R@ in modern usage). So, that's really talking 
about "other use" meaning other than as a loop counter. The loop counter 
itself doesn't exist outside the loop in any case!

That is wildly problematic in modern Forths, which is why R@ exists!

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#9878

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-06 11:26 +0000
Message-ID<2012Mar6.122659@mips.complang.tuwien.ac.at>
In reply to#9869
"Elizabeth D. Rather" <erather@forth.com> writes:
>On 3/5/12 12:11 PM, Elizabeth D. Rather wrote:
>> fig-Forth says other use of 'I', i.e., that outside a loop, is
>> implementation dependent.
>
>I suddenly realize what that statement is trying to say:  in early 
>Forths, the loop parameters were *always* on the Return Stack. So, some 
>people used I outside a loop to get a copy of whatever is on the Return 
>Stack (equivalent to R@ in modern usage). So, that's really talking 
>about "other use" meaning other than as a loop counter. The loop counter 
>itself doesn't exist outside the loop in any case!
>
>That is wildly problematic in modern Forths, which is why R@ exists!

fig-Forth has R (nowadays called R@) and that despite I and R doing
the same thing, so obviously people already found it useful to
differentiate between these words at that time.

If these words were not already standardized, at least one would not
make it: Imagine: Introduce two words where one would do?  The word
count!  The complexity!

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9880

Fromrickman <gnuarm@gmail.com>
Date2012-03-06 05:42 -0800
Message-ID<37b5b12d-d3c6-49f0-93bc-d88b3f175249@w19g2000vbe.googlegroups.com>
In reply to#9878
On Mar 6, 6:26 am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
wrote:
> "Elizabeth D. Rather" <erat...@forth.com> writes:
>
> >On 3/5/12 12:11 PM, Elizabeth D. Rather wrote:
> >> fig-Forth says other use of 'I', i.e., that outside a loop, is
> >> implementation dependent.
>
> >I suddenly realize what that statement is trying to say:  in early
> >Forths, the loop parameters were *always* on the Return Stack. So, some
> >people used I outside a loop to get a copy of whatever is on the Return
> >Stack (equivalent to R@ in modern usage). So, that's really talking
> >about "other use" meaning other than as a loop counter. The loop counter
> >itself doesn't exist outside the loop in any case!
>
> >That is wildly problematic in modern Forths, which is why R@ exists!
>
> fig-Forth has R (nowadays called R@) and that despite I and R doing
> the same thing, so obviously people already found it useful to
> differentiate between these words at that time.
>
> If these words were not already standardized, at least one would not
> make it: Imagine: Introduce two words where one would do?  The word
> count!  The complexity!
>
> - anton
> --
> M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
> comp.lang.forth FAQs:http://www.complang.tuwien.ac.at/forth/faq/toc.html
>      New standard:http://www.forth200x.org/forth200x.html
>    EuroForth 2011:http://www.euroforth.org/ef11/

You can define one in terms of the other in your implementation where
you know they are the same.  So no complication.

But in a standard forth no assumption is made about the loop control
variables being on the return stack.  It is permitted, but not
required.  You do know that I'm sure.

Rick

[toc] | [prev] | [next] | [standalone]


#9882

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-06 14:51 +0000
Message-ID<2012Mar6.155158@mips.complang.tuwien.ac.at>
In reply to#9880
rickman <gnuarm@gmail.com> writes:
>On Mar 6, 6:26=A0am, an...@mips.complang.tuwien.ac.at (Anton Ertl)
>wrote:
>> fig-Forth has R (nowadays called R@) and that despite I and R doing
>> the same thing, so obviously people already found it useful to
>> differentiate between these words at that time.
>>
>> If these words were not already standardized, at least one would not
>> make it: Imagine: Introduce two words where one would do? =A0The word
>> count! =A0The complexity!
...
>You can define one in terms of the other in your implementation where
>you know they are the same.  So no complication.
>
>But in a standard forth no assumption is made about the loop control
>variables being on the return stack.  It is permitted, but not
>required.  You do know that I'm sure.

Sure, but the setting would not be a world where Forth-94 is standard,
but a world where we have not already standardized counted loops, but
with people using arguments like they do now.  So, the choice would be

1) Standardize R@ and I to allow different implementations of counted
loops.

2) Standardize just R@, which also serves the purpose of I (or vice versa).

A proponent who proposes 1) would face counterarguments based on word
counts; arguments based on implementation flexibility would have
little weight, if any, with the word counters, especially because
AFAIK at the time all implementations of counted loops had R=I
(fig-Forth certainly did).

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9883

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-06 10:17 -0600
Message-ID<9KydnWceW74opcvSnZ2dnUVZ_uednZ2d@supernews.com>
In reply to#9882
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:

> Sure, but the setting would not be a world where Forth-94 is standard,
> but a world where we have not already standardized counted loops, but
> with people using arguments like they do now.  So, the choice would be
> 
> 1) Standardize R@ and I to allow different implementations of counted
> loops.
> 
> 2) Standardize just R@, which also serves the purpose of I (or vice versa).
> 
> A proponent who proposes 1) would face counterarguments based on word
> counts; arguments based on implementation flexibility would have
> little weight, if any, with the word counters, especially because
> AFAIK at the time all implementations of counted loops had R=I
> (fig-Forth certainly did).

But many (all?) implementations of Forth-83 didn't have R = I.

Andrew.

[toc] | [prev] | [next] | [standalone]


#9884

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-06 16:49 +0000
Message-ID<2012Mar6.174920@mips.complang.tuwien.ac.at>
In reply to#9883
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>But many (all?) implementations of Forth-83 didn't have R = I.

That's just as beside my point as rickmans answer was, so I guess I
did not make my point very well.  Let's try again:

I think that some people are giving too much weight to word counting
when discussing proposals and too little weight to other issues.  An
example where we are happy with having more words is R@ and I, which
originally were synonyms.

But while we are in the area, n +LOOP is a mistake, probably partly
driven by word counting and partly by a cute implementation idea*.
It's better to have two words, one for each direction: u /LOOP for
counting up and u -LOOP for counting down.

*) Incidentially, that implementation idea gave use Is that are
 different from R@.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9886

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-06 11:56 -0600
Message-ID<R42dnSPTErtG0svSnZ2dnUVZ_hqdnZ2d@supernews.com>
In reply to#9884
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>But many (all?) implementations of Forth-83 didn't have R = I.
> 
> That's just as beside my point as rickmans answer was, so I guess I
> did not make my point very well.  Let's try again:
> 
> I think that some people are giving too much weight to word counting
> when discussing proposals and too little weight to other issues.  An
> example where we are happy with having more words is R@ and I, which
> originally were synonyms.

Perhaps.

> But while we are in the area, n +LOOP is a mistake, probably partly
> driven by word counting and partly by a cute implementation idea*.

But +LOOP existed long before said cute implementation idea.  For
example, polyFORTH had +LOOP for signed loops and /LOOP for unsigned
ones.

> It's better to have two words, one for each direction: u /LOOP for
> counting up and u -LOOP for counting down.
> 
> *) Incidentially, that implementation idea gave use Is that are
> different from R@.

Andrew.

[toc] | [prev] | [next] | [standalone]


#9887

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-06 18:07 +0000
Message-ID<2012Mar6.190753@mips.complang.tuwien.ac.at>
In reply to#9886
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> I think that some people are giving too much weight to word counting
>> when discussing proposals and too little weight to other issues.  An
>> example where we are happy with having more words is R@ and I, which
>> originally were synonyms.
>
>Perhaps.

You are not happy with that?

>> But while we are in the area, n +LOOP is a mistake, probably partly
>> driven by word counting and partly by a cute implementation idea*.
>
>But +LOOP existed long before said cute implementation idea.  For
>example, polyFORTH had +LOOP for signed loops and /LOOP for unsigned
>ones.

The +LOOP before Forth-83 was different (and there was probably more
than one behaviour), but it's existence may be another reason for the
+LOOP of Forth-83.  IIRC the fig-Forth version worked symmetrically
with negative numbers; that's a lot saner than the Forth-83/94/200x
+LOOP.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#9909

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-07 04:14 -0600
Message-ID<AsydnTum3JeYqMrSnZ2dnUVZ_rqdnZ2d@supernews.com>
In reply to#9887
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>> I think that some people are giving too much weight to word counting
>>> when discussing proposals and too little weight to other issues.  An
>>> example where we are happy with having more words is R@ and I, which
>>> originally were synonyms.
>>
>>Perhaps.
> 
> You are not happy with that?

Well, if we had +LOOP and /LOOP we wouldn't need it, and I have always
been convinced that the Forth-83 +LOOP was a disaster.

>>> But while we are in the area, n +LOOP is a mistake, probably partly
>>> driven by word counting and partly by a cute implementation idea*.
>>
>>But +LOOP existed long before said cute implementation idea.  For
>>example, polyFORTH had +LOOP for signed loops and /LOOP for unsigned
>>ones.
> 
> The +LOOP before Forth-83 was different (and there was probably more
> than one behaviour), but it's existence may be another reason for the
> +LOOP of Forth-83.  IIRC the fig-Forth version worked symmetrically
> with negative numbers; that's a lot saner than the Forth-83/94/200x
> +LOOP.

Mm.  FWIW the polyFORTH one didn't, as I'm sure you can see in the
first edition of Starting FORTH.

Andrew.

[toc] | [prev] | [next] | [standalone]


#10047

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-12 15:56 +0000
Message-ID<2012Mar12.165638@mips.complang.tuwien.ac.at>
In reply to#9909
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>> I think that some people are giving too much weight to word counting
>>>> when discussing proposals and too little weight to other issues.  An
>>>> example where we are happy with having more words is R@ and I, which
>>>> originally were synonyms.
>>>
>>>Perhaps.
>> 
>> You are not happy with that?
>
>Well, if we had +LOOP and /LOOP we wouldn't need it,

Are we talking about the same thing: That we have R@ as a separate
word from I.  That's already interesting with LOOP, so I don't think
that the presence or absence of +LOOP plays a role.

[+LOOP]
>> the fig-Forth version worked symmetrically
>> with negative numbers; that's a lot saner than the Forth-83/94/200x
>> +LOOP.
>
>Mm.  FWIW the polyFORTH one didn't, as I'm sure you can see in the
>first edition of Starting FORTH.

I don't have the first edition, so I cannot see it, but I'll believe
you anyway:-)

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#10051

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-12 11:23 -0500
Message-ID<542dnRtSNveMvsPSnZ2dnUVZ_qqdnZ2d@supernews.com>
In reply to#10047
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>>> I think that some people are giving too much weight to word counting
>>>>> when discussing proposals and too little weight to other issues.  An
>>>>> example where we are happy with having more words is R@ and I, which
>>>>> originally were synonyms.
>>>>
>>>>Perhaps.
>>> 
>>> You are not happy with that?
>>
>>Well, if we had +LOOP and /LOOP we wouldn't need it,
> 
> Are we talking about the same thing: That we have R@ as a separate
> word from I.

Yes.  The first time that R@ was ever different from I was, to the
best of my knowledge, the overflow-flag-based algorithm that motivated
the 83-standard DO ... LOOP.

Andrew.

[toc] | [prev] | [next] | [standalone]


#10052

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2012-03-12 16:26 +0000
Message-ID<2012Mar12.172632@mips.complang.tuwien.ac.at>
In reply to#10051
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Yes.  The first time that R@ was ever different from I was, to the
>best of my knowledge, the overflow-flag-based algorithm that motivated
>the 83-standard DO ... LOOP.

That may have been the first time when they were not synonyms, but
certainly fig-Forth had a word I and a word R (they were synonyms).

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2011: http://www.euroforth.org/ef11/

[toc] | [prev] | [next] | [standalone]


#10053

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2012-03-12 12:28 -0500
Message-ID<VcadncM4huLdr8PSnZ2dnUVZ_rOdnZ2d@supernews.com>
In reply to#10052
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>Yes.  The first time that R@ was ever different from I was, to the
>>best of my knowledge, the overflow-flag-based algorithm that motivated
>>the 83-standard DO ... LOOP.
> 
> That may have been the first time when they were not synonyms,

Well, yes: that's what "different" means.  If they are synonyms, then
they're "the same".

> but certainly fig-Forth had a word I and a word R (they were
> synonyms).

I think I have misunderstood you.  You wrote

> An example where we are happy with having more words is R@ and I,
> which originally were synonyms.

which I understood to mean that we are happy to have R@ and I be
different, and have different actions.  I now think you didn't mean
that, but "when I@ and R were synonyms we were quite happy to have two
names for the same action".  I agree with that.

Andrew.

[toc] | [prev] | [next] | [standalone]


#9889

From"Rod Pemberton" <do_not_have@noavailemail.cmm>
Date2012-03-06 13:36 -0500
Message-ID<jj5lgj$nn6$1@speranza.aioe.org>
In reply to#9884
"Anton Ertl" <anton@mips.complang.tuwien.ac.at> wrote in message
news:2012Mar6.174920@mips.complang.tuwien.ac.at...
> [...]
> But while we are in the area, n +LOOP is a mistake, probably partly
> driven by word counting and partly by a cute implementation idea*.
> It's better to have two words, one for each direction: u /LOOP for
> counting up and u -LOOP for counting down.
>

/LOOP for up?  Yeah, like, that's not confusing ...

Doesn't / mean divide in Forth?  mathematics?  everywhere?

Well, if you're going to split LOOP like that, I would suggest +LOOP for up
and -LOOP for down.  That makes sense ...  syntactically too ...

Another problem, AISI, is that splitting LOOP into up and down doesn't take
into account the signed 'n' value ...  Is 'n' unsigned in this scenario?
Or, do you take the absolute value of 'n'?  Or, do you leave 'n' signed and
allow the direction of <x>LOOP to be changed?

One of the problems I'm seeing from Forth standard to Forth standard is name
collision.  Instead of redefining a word to do what it should've done, i.e.,
with correct functionality, you guys pick an alternate poorly chosen,
non-representative name with the correct functionality just to avoid naming
collisions.  IMO, that's a bad choice.  Supposedly, this is to ensure
backward compatibility with old code.  But, just look at the horrid,
unrepresentative word names you've got now ...  It'd be better if you guys
started from scratch and named the not functionality NOT, the compile
functionality COMPILE, etc.  Wouldn't it?  Do you really want /LOOP for up?


Rod Pemberton


[toc] | [prev] | [next] | [standalone]


#9891

From"Elizabeth D. Rather" <erather@forth.com>
Date2012-03-06 09:18 -1000
Message-ID<0o-dneoD_bKI_svSnZ2dnUVZ_s2dnZ2d@supernews.com>
In reply to#9889
On 3/6/12 8:36 AM, Rod Pemberton wrote:
> "Anton Ertl"<anton@mips.complang.tuwien.ac.at>  wrote in message
> news:2012Mar6.174920@mips.complang.tuwien.ac.at...
>> [...]
>> But while we are in the area, n +LOOP is a mistake, probably partly
>> driven by word counting and partly by a cute implementation idea*.
>> It's better to have two words, one for each direction: u /LOOP for
>> counting up and u -LOOP for counting down.
>>
>
> /LOOP for up?  Yeah, like, that's not confusing ...
>
> Doesn't / mean divide in Forth?  mathematics?  everywhere?

It visually suggests a ramp up. In fact, the word was pronounced 
"ramp-LOOP".

> Well, if you're going to split LOOP like that, I would suggest +LOOP for up
> and -LOOP for down.  That makes sense ...  syntactically too ...
>
> Another problem, AISI, is that splitting LOOP into up and down doesn't take
> into account the signed 'n' value ...  Is 'n' unsigned in this scenario?
> Or, do you take the absolute value of 'n'?  Or, do you leave 'n' signed and
> allow the direction of<x>LOOP to be changed?

+LOOP takes a signed argument.  /LOOP took an unsigned argument, meaning 
it had twice the range (useful in 16-bit implementations).

> One of the problems I'm seeing from Forth standard to Forth standard is name
> collision.  Instead of redefining a word to do what it should've done, i.e.,
> with correct functionality, you guys pick an alternate poorly chosen,
> non-representative name with the correct functionality just to avoid naming
> collisions.  IMO, that's a bad choice.  Supposedly, this is to ensure
> backward compatibility with old code.  But, just look at the horrid,
> unrepresentative word names you've got now ...  It'd be better if you guys
> started from scratch and named the not functionality NOT, the compile
> functionality COMPILE, etc.  Wouldn't it?  Do you really want /LOOP for up?

The FORTH83 standard took that approach, and changed the meaning of a 
lot of common words to what they "should've" been, and the result was 
chaos. Standards teams the world over, for all technologies, are advised 
to avoid re-defining things that have a commonly-understood meaning. You 
can't turn back the clock.

When you publish a new standard, you want to encourage as many people to 
adopt it as possible. That makes ensuring that compliance is easy, 
meaning that folks can continue to use their old code with new systems 
(maybe using a simple compatibility layer) and gradually adopt the new 
functions. MPE and FORTH, Inc. have customers with critical applications 
involving many thousands of lines of code. And who knows how many users 
there are of gForth, Win32Forth, etc. One cannot afford to be cavalier 
about these things.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#9902

Fromhwfwguy@gmail.com
Date2012-03-06 20:14 -0800
Message-ID<17899153.6531.1331093680078.JavaMail.geo-discussion-forums@vbkc1>
In reply to#9889
On Tuesday, March 6, 2012 11:36:29 AM UTC-7, Rod Pemberton wrote:
> /LOOP for up?  Yeah, like, that's not confusing ...
> 
> Doesn't / mean divide in Forth?  mathematics?  everywhere?
> 
> Well, if you're going to split LOOP like that, I would suggest +LOOP for up
> and -LOOP for down.  That makes sense ...  syntactically too ...

Much ado about nothing. In most cases, +LOOP is preceeded by a constant which an optimizer can use to decide whether to encode +LOOP, /LOOP, etc. It's no longer 1980.

[toc] | [prev] | [next] | [standalone]


#9913

FromBruceMcF <agila61@netscape.net>
Date2012-03-07 08:22 -0800
Message-ID<9459fe39-fdc1-4e2f-aa53-fa83219943fc@i16g2000yql.googlegroups.com>
In reply to#9902
On Mar 6, 11:14 pm, hwfw...@gmail.com wrote:
> Much ado about nothing. In most cases, +LOOP is
> preceeded by a constant which an optimizer can use
> to decide whether to encode +LOOP, /LOOP, etc. It's
> no longer 1980.

Whether to use crossing the higher boundary or the lower boundary when
stepping down is specified when saying "+LOOP" ~ however the compiler
optimizes it had better not change that boundary.

That is was the -LOOP when stepping down proposal is about ~
specifying the alternate loop boundary. With integers, after all,
there's only the two possible loop boundaries.

[toc] | [prev] | [next] | [standalone]


#9916

Fromrickman <gnuarm@gmail.com>
Date2012-03-07 10:20 -0800
Message-ID<8142ab49-cf9d-4264-9c2a-0dc059ac974e@db5g2000vbb.googlegroups.com>
In reply to#9913
On Mar 7, 11:22 am, BruceMcF <agil...@netscape.net> wrote:
> On Mar 6, 11:14 pm, hwfw...@gmail.com wrote:
>
> > Much ado about nothing. In most cases, +LOOP is
> > preceeded by a constant which an optimizer can use
> > to decide whether to encode +LOOP, /LOOP, etc. It's
> > no longer 1980.
>
> Whether to use crossing the higher boundary or the lower boundary when
> stepping down is specified when saying "+LOOP" ~ however the compiler
> optimizes it had better not change that boundary.
>
> That is was the -LOOP when stepping down proposal is about ~
> specifying the alternate loop boundary. With integers, after all,
> there's only the two possible loop boundaries.

Ok, I'll bite, what are they?

Rick

[toc] | [prev] | [next] | [standalone]


Page 1 of 6  [1] 2 3 4 5 6  Next page →

Back to top | Article view | comp.lang.forth


csiph-web