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


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

unexpected +LOOP behavior

Started bychitselb <chitselb@gmail.com>
First post2015-05-23 19:27 -0700
Last post2015-05-24 14:06 +0000
Articles 20 on this page of 151 — 19 participants

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


Contents

  unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-23 19:27 -0700
    Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-23 20:27 -0700
      Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-24 13:44 +0200
        Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-24 10:36 -0400
          Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-24 23:16 +0200
            Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 15:57 -0700
            Re: unexpected +LOOP behavior Bernd Paysan <bernd.paysan@gmx.de> - 2015-05-25 02:21 +0200
              Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-24 15:21 -1000
                Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 19:49 -0700
              Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 18:22 -0700
              Re: unexpected +LOOP behavior "WJ" <w_a_x_man@yahoo.com> - 2015-05-26 17:20 +0000
                Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-26 14:15 -0400
                  Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-26 08:37 -1000
                    Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-26 15:09 -0400
                      Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-26 09:19 -1000
                        Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-26 17:08 -0400
                          Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-26 15:42 -0700
                            Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-26 19:30 -0400
                              Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-26 17:45 -0700
                                Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-26 21:33 -0400
                                Re: unexpected +LOOP behavior Coos Haak <chforth@hccnet.nl> - 2015-05-27 14:08 +0200
                                  Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-27 06:32 -0700
                                    Re: unexpected +LOOP behavior Coos Haak <chforth@hccnet.nl> - 2015-05-27 16:15 +0200
                            Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-26 14:32 -1000
                          Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-27 08:30 +0000
                            Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 17:15 -0400
                    Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-29 21:05 -0700
            Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-25 01:41 -0400
              Re: unexpected +LOOP behavior Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-24 23:26 -0700
                Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-25 14:33 +0000
                Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-25 10:56 -0400
                  Re: unexpected +LOOP behavior Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-25 11:28 -0700
                    Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-25 14:33 -0400
                    Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-25 12:57 -0700
                    Re: unexpected +LOOP behavior humptydumpty <ouatubi@gmail.com> - 2015-05-25 23:01 -0700
            Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-25 14:21 +0000
            Re: unexpected +LOOP behavior albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-05-26 23:59 +0000
            Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-27 09:15 +0000
              Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-27 10:06 +0000
              Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 12:03 -0400
                Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-27 16:23 +0000
                  Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 12:39 -0400
              Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-27 22:14 +0200
                Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 17:13 -0400
                  Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-27 23:36 +0200
                    Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 18:06 -0400
                      Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-29 10:35 +0200
                        Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 12:16 +0100
                          Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-29 09:42 -0400
                          Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-29 16:16 +0200
                            Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 15:24 +0100
                Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-27 17:32 -0400
                  Re: unexpected +LOOP behavior Coos Haak <chforth@hccnet.nl> - 2015-05-27 23:59 +0200
                    Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-27 19:31 -0400
                  Re: unexpected +LOOP behavior Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-05-27 23:11 -0700
                Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-28 12:21 +0100
                  Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-28 12:24 +0100
                  Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-29 10:53 +0200
                    Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 12:19 +0100
                Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 13:51 +0000
                  Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-29 17:48 +0200
              Re: unexpected +LOOP behavior Bernd Paysan <bernd.paysan@gmx.de> - 2015-05-29 02:08 +0200
                Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 08:25 +0000
                  Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 12:40 +0100
                    Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-29 13:16 +0000
                    Re: unexpected +LOOP behavior albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-05-29 18:43 +0000
                      Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-29 20:08 +0100
                      x86 tricks Lars Brinkhoff <lars.spam@nocrew.org> - 2015-06-05 09:42 +0200
                        Re: x86 tricks albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-06-05 09:32 +0000
                        Re: x86 tricks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-05 09:40 +0000
                          Re: x86 tricks albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-06-05 11:17 +0000
                            Re: x86 tricks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-05 15:49 +0000
                              Re: x86 tricks "Alex McDonald" <blog@rivadpm.com> - 2015-06-05 17:45 +0100
                                Re: x86 tricks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-05 16:53 +0000
                                  Re: x86 tricks rickman <gnuarm@gmail.com> - 2015-06-07 13:20 -0400
                                    Re: x86 tricks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-08 07:18 +0000
                                  Re: x86 tricks Bernd Paysan <bernd.paysan@gmx.de> - 2015-06-08 17:18 +0200
                                    Re: x86 tricks Tessa Bonting <tessa.bonting@gmail.com> - 2015-06-08 08:42 -0700
                              Re: x86 tricks albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-06-06 09:47 +0000
                                Re: x86 tricks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-07 15:05 +0000
                                  Re: x86 tricks "Alex McDonald" <blog@rivadpm.com> - 2015-06-07 17:49 +0100
                        Re: x86 tricks "Alex McDonald" <blog@rivadpm.com> - 2015-06-05 13:19 +0100
        Re: unexpected +LOOP behavior Mark Wills <markwills1970@gmail.com> - 2015-05-25 01:38 -0700
    Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-23 21:33 -0700
      Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-23 22:10 -0700
        Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-23 22:20 -0700
          Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-25 21:13 -0700
            Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-27 17:34 -0400
              Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-27 22:04 -0700
                Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-28 01:27 -0400
                  Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-28 03:20 -0400
                    Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-28 04:13 -0400
                      Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-29 04:23 -0400
                        Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-29 11:28 -0400
                          Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-29 18:32 -0400
                            Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-29 18:53 -0400
        Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-23 22:26 -0700
          Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-23 21:37 -1000
            Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 10:24 -0700
              Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-24 20:40 -0400
              Re: unexpected +LOOP behavior Hans Bezemer <the.beez.speaks@gmail.com> - 2015-05-25 14:08 +0200
                Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-25 17:27 -0400
                  Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-25 14:47 -1000
                    Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-27 17:33 -0400
              Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-25 12:53 -0700
                Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-25 13:05 -0700
                Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-25 14:49 -1000
                  Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-25 18:03 -0700
                    Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-05-25 16:44 -1000
                    Re: unexpected +LOOP behavior humptydumpty <ouatubi@gmail.com> - 2015-05-25 22:56 -0700
                    Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-26 08:05 +0000
          Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-24 10:43 -0400
            Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-24 08:29 -0700
              Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-24 15:44 +0000
                Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-27 00:57 -0700
                Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-06-05 13:11 -0700
                  Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-06-05 12:24 -1000
                    Re: unexpected +LOOP behavior JennyB <jennybrien@googlemail.com> - 2015-06-06 13:29 -0700
                    Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-07 14:56 +0000
                      Re: unexpected +LOOP behavior "Elizabeth D. Rather" <erather@forth.com> - 2015-06-07 10:38 -1000
                        Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-06-08 08:08 +0000
          Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 10:01 -0700
        Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-24 10:40 -0400
          Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 11:29 -0700
            Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-25 09:51 -0700
              Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-25 10:44 -0700
                Re: unexpected +LOOP behavior "Alex McDonald" <blog@rivadpm.com> - 2015-05-25 12:34 -0700
                  Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-25 12:59 -0700
    unexpected +LOOP behavior Mark Wills <markwills1970@gmail.com> - 2015-05-24 01:39 -0700
      Re: unexpected +LOOP behavior Coos Haak <chforth@hccnet.nl> - 2015-05-24 14:46 +0200
        Re: unexpected +LOOP behavior Mark Wills <markwills1970@gmail.com> - 2015-05-25 01:17 -0700
      Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-24 20:48 -0400
        Re: unexpected +LOOP behavior hughaguilar96@gmail.com - 2015-05-24 18:15 -0700
        Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-25 12:35 +0000
          Re: unexpected +LOOP behavior "Rod Pemberton" <fork@lllljunkqwer.cpm> - 2015-05-25 17:27 -0400
            Re: unexpected +LOOP behavior rickman <gnuarm@gmail.com> - 2015-05-25 18:16 -0400
              Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-25 16:17 -0700
                Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-25 17:16 -0700
                  Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-25 17:50 -0700
                    Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-25 18:47 -0700
                Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-25 20:01 -0700
                  Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-25 20:29 -0700
                  Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-25 20:32 -0700
                Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-26 08:03 +0000
                  Re: unexpected +LOOP behavior Mark Wills <markwills1970@gmail.com> - 2015-05-26 01:10 -0700
                    Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-26 22:31 -0700
                  Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-26 20:07 -0700
                  Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-26 20:20 -0700
                    Re: unexpected +LOOP behavior Michael Barry <barrym95838@yahoo.com> - 2015-05-26 22:00 -0700
                      Re: unexpected +LOOP behavior chitselb <chitselb@gmail.com> - 2015-05-27 02:41 -0700
    Re: unexpected +LOOP behavior anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-05-24 14:06 +0000

Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →


#39618 — Re: x86 tricks

From"Alex McDonald" <blog@rivadpm.com>
Date2015-06-07 17:49 +0100
SubjectRe: x86 tricks
Message-ID<ml1sk3$aum$1@dont-email.me>
In reply to#39617
on 07/06/2015 16:05:39,  wrote:
> albert@spenarnc.xs4all.nl (Albert van der Horst) writes:
>>In article <2015Jun5.174917@mips.complang.tuwien.ac.at>,
>>Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>>albert@spenarnc.xs4all.nl (Albert van der Horst) writes:
>>>>Did you say tricks? I hate that. I just use the instruction set to
>>>>optimal effect. What I want is to minimize the number of instructions
>>>>without heading the urban legends like LODS is slow etc.
>>>
>>>It's not an urban legend, it's a fact; look in the 486 timing tables.
>>>Bernd Beuster switched from LODS to MOV/ADD, resulting in a speedup.
>>
>>I call it an urban myth because one never knows when it were
>>true or is true.
> 
> Sure, you measure your Forth system with a NEXT using LODSD, and with
> a NEXT using MOV and ADD, and compare the performance on the hardware
> you are interested in.  Then you know.  On the 486 LODSD was slower,
> as shown by Bernd Beuster.
> 
>>Speed is so overrated. I've slowed down my system from 2.8 Ghz to
>>1 Ghz because of hardware problems.
> 
> If speed is overrated, why did you pay more for a 2.8GHz processor
> then?  An Atom-based system or the system you had before would have
> been sufficient, no?
> 
>>I thought about using RET for next too, but
>>of course, unless the system is sophisticated, this plays havoc
>>with interrupts, so I never even tried an experiment with it.
>>(Those microprocessors, say a Z80, would not predict or mispredict
>>anything though.)
> 
> How does a Z80 come into play in a thread about "x86 tricks"?
> 
> On IA-32 or AMD64 hardware, nowadays you usually run a protected-mode
> OS, and user space does not normally see interrupts, so RET is safe to
> use. For Unix signal handlers (the closest that Unix has to
> interrupts), you can set up the stack for use by the signal handlers
> with sigaltstack(). Windows experts can fill in how this might be done
> in Windows.

In 32 bit mode, SEH (structured exception handling, a bit like CATCH)
requires information on the stack. It can't live anywhere else (I know,
I've tried putting it elsewhere). Otherwise the user stack is unused by
and unaffected by interrupts, hard or soft, and I believe the same is
true of 64 bit mode.

> 
> - anton

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


#39577 — Re: x86 tricks

From"Alex McDonald" <blog@rivadpm.com>
Date2015-06-05 13:19 +0100
SubjectRe: x86 tricks
Message-ID<mks41i$ftu$1@dont-email.me>
In reply to#39565
on 05/06/2015 08:42:00, Lars Brinkhoff wrote:
> Albert van der Horst wrote:
>> Alex McDonald wrote:
>>>For Intel x86 assuming eax=TOS;
>>>
>>>code 0<>        ( x -- f1 )
>>>                add     eax -1
>>>                sbb     eax eax
>>
>> Or
>>                 neg    ax
>>                 sbb    ax ax
>>
>> To avoid potentially large immediate data.
>> (dec ax doesn't affect the carry flag).
>>
>>>Equivalently
>>>
>>>code 0=         ( x -- f1 )
>>>                sub     eax 1
>>>                sbb     eax eax
>>>
>>>Both generate well formed flags.
>>
>>                 neg    ax
>>                 cmc
>>                 sbb    ax ax
>>
>> (Got those from Coos Haak I guess.)
> 
> Love it!
> 
> What other x86 assembler tricks do you have up your sleeves? How do
> you allocate registers to SP/RP/TOS/IP? What's the fastest NEXT in ITC
> or DTC?  Do you use special instructions like LODSD?
> 

code 0<         ( x -- fl )
                sar     eax cell 8 * 1- 

CELL 8 * 1- works out as 31 for 32 bit and 63 for 64 bit. 

My Forth is an STC, so NEXT is a RET. SP is EBP, RP is ESP, TOS is EAX,
IP is the real PC. EBX is for task-specific stuff like USER variables.
ECX EDX ESI EDI are free.

There is somewhere out in intertubes land a fairly substantial PDF full
of these written in C. And there are lots of other sites that have these
bit twiddles. As Anton notices, some of them may be slow, but dammit,
aren't they short and cute?



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


#39279

FromMark Wills <markwills1970@gmail.com>
Date2015-05-25 01:38 -0700
Message-ID<819f317a-e189-4896-8d07-f2146b650f5f@googlegroups.com>
In reply to#39244
On Sunday, 24 May 2015 12:44:56 UTC+1, The Beez  wrote:
> 
> Forth-83 added lots of horrible, "clever" tricks that made the language
> almost unusable. "All bits set" for TRUE was another one. Really, it's no
> wonder Forth went through the drain in the late 80-ies.

Is that a problem in practice?

I can do (for example)

port@ $40 AND IF ... ELSE ... THEN 

I do *not* have to do:

port@ $40 AND 0> IF ... ELSE ... THEN 

So in practice this has never been a problem for me.

?

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


#39235

FromMichael Barry <barrym95838@yahoo.com>
Date2015-05-23 21:33 -0700
Message-ID<c8aab894-c934-4f43-b87c-4d5c57ffd5c7@googlegroups.com>
In reply to#39232
On Saturday, May 23, 2015 at 7:27:29 PM UTC-7, chitselb wrote:
> [snip]
> These results threw me off.  Why does the standard have that extra
> iteration for negative loop increments?

Hugh is correct about the V-flag "optimization", which requires a
  hidden fudge-factor for the index.  It applies to LOOP as well,
  AFAIK.  Laxen & Perry of F83 fame are "credited" with this idea
  and original implementation, according to my limited research.

Mike

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


#39237

Fromhughaguilar96@gmail.com
Date2015-05-23 22:10 -0700
Message-ID<1a315aac-9a17-4645-89f5-5baac403d4b3@googlegroups.com>
In reply to#39235
On Saturday, May 23, 2015 at 9:33:02 PM UTC-7, Michael Barry wrote:
> On Saturday, May 23, 2015 at 7:27:29 PM UTC-7, chitselb wrote:
> > [snip]
> > These results threw me off.  Why does the standard have that extra
> > iteration for negative loop increments?
> 
> Hugh is correct about the V-flag "optimization", which requires a
>   hidden fudge-factor for the index.  It applies to LOOP as well,
>   AFAIK.  Laxen & Perry of F83 fame are "credited" with this idea
>   and original implementation, according to my limited research.
> 
> Mike

I'm pretty sure that DO loops go back to the very original Forth, so it was likely Charles Moore who came up with the idea.

In the 1970s, computers had very little memory. It was a different world. Clever tricks to save a few bytes were common in assembly-language, and but good programming style was considered an exorbitant luxury. It was in this context that DO loops were invented. In its day, it was a good thing, so I wouldn't knock whoever came up with the idea --- but that day has long passed.

A problem I see with ANS-Forth, is too much concern about legacy code. Charles Moore left, and then nobody took the helm as a leader. Everybody just held onto Charles Moore's code from the 1970s as if he had brought it down from Mt. Sinai written on stone tablets. ANS-Forth even included PAD which was most likely just a quick hack that Charles Moore did on some extremely memory-starved computer in the 1970s --- it seems very unlikely that he wanted PAD to get put in the standard. 

Programming in ANS-Forth is like living through Groundhog Day in which it is always 1979 and Forth always has a lot of "potential" to become useful.

Will PAD get put in Forth-200x too? Inquiring minds want to know...

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


#39238

Fromchitselb <chitselb@gmail.com>
Date2015-05-23 22:20 -0700
Message-ID<a3259a58-b7aa-4a2b-89e0-8c3f9491beb0@googlegroups.com>
In reply to#39237
On Sunday, May 24, 2015 at 1:10:32 AM UTC-4, hughag...@gmail.com wrote:
> On Saturday, May 23, 2015 at 9:33:02 PM UTC-7, Michael Barry wrote:
> > On Saturday, May 23, 2015 at 7:27:29 PM UTC-7, chitselb wrote:
> > > [snip]
> > > These results threw me off.  Why does the standard have that extra
> > > iteration for negative loop increments?
> > 
> > Hugh is correct about the V-flag "optimization", which requires a
> >   hidden fudge-factor for the index.  It applies to LOOP as well,
> >   AFAIK.  Laxen & Perry of F83 fame are "credited" with this idea
> >   and original implementation, according to my limited research.
> > 
> > Mike
> 
> I'm pretty sure that DO loops go back to the very original Forth, so it was likely Charles Moore who came up with the idea.
> 
> In the 1970s, computers had very little memory. It was a different world. Clever tricks to save a few bytes were common in assembly-language, and but good programming style was considered an exorbitant luxury. It was in this context that DO loops were invented. In its day, it was a good thing, so I wouldn't knock whoever came up with the idea --- but that day has long passed.
> 
> A problem I see with ANS-Forth, is too much concern about legacy code. Charles Moore left, and then nobody took the helm as a leader. Everybody just held onto Charles Moore's code from the 1970s as if he had brought it down from Mt. Sinai written on stone tablets. ANS-Forth even included PAD which was most likely just a quick hack that Charles Moore did on some extremely memory-starved computer in the 1970s --- it seems very unlikely that he wanted PAD to get put in the standard. 
> 
> Programming in ANS-Forth is like living through Groundhog Day in which it is always 1979 and Forth always has a lot of "potential" to become useful.
> 
> Will PAD get put in Forth-200x too? Inquiring minds want to know...

Full disclosure:  I'm implementing this Forth on 1979 hardware (Commodore PET 2001-N) so byte squeezing is a necessity and a retro feel is okay.  I'm blending the various standards together in a way that.
A) makes sense to me
B) shouldn't surprise another Forth programmer

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


#39321

Fromhughaguilar96@gmail.com
Date2015-05-25 21:13 -0700
Message-ID<a93d5bb2-992e-4ad2-8467-050e2b573c59@googlegroups.com>
In reply to#39238
On Saturday, May 23, 2015 at 10:20:17 PM UTC-7, chitselb wrote:
> Full disclosure:  I'm implementing this Forth on 1979 hardware (Commodore PET 2001-N) so byte squeezing is a necessity and a retro feel is okay.  I'm blending the various standards together in a way that.
> A) makes sense to me
> B) shouldn't surprise another Forth programmer

Why did you choose the PET? I suppose, because you had one. 

The Commodore-64 was much more popular --- if you did the C64, you could find retro enthusiasts who would play with your Forth. 

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


#39366

From"Rod Pemberton" <fork@lllljunkqwer.cpm>
Date2015-05-27 17:34 -0400
Message-ID<op.xzbcvajfwhxjl4@localhost>
In reply to#39321
On Tue, 26 May 2015 00:13:44 -0400, <hughaguilar96@gmail.com> wrote:
> On Saturday, May 23, 2015 at 10:20:17 PM UTC-7, chitselb wrote:

>> Full disclosure:  I'm implementing this Forth on 1979 hardware  
>> (Commodore PET 2001-N) so byte squeezing is a necessity and a retro  
>> feel is okay.  I'm blending the various standards together in a way  
>> that.
>> A) makes sense to me
>> B) shouldn't surprise another Forth programmer

Doesn't that mean fig-Forth? ...

> Why did you choose the PET? I suppose, because you had one.
>
> The Commodore-64 was much more popular --- if you did the C64, you
> could find retro enthusiasts who would play with your Forth.

It seems he wants a challenge.  Perhaps, a VIC-20 would be better?
Or, for an even more extreme challenge, perhaps an Altair 8800 or
IMSAI 8080? ...


Rod Pemberton
-- 
If fewer guns reduced murders, how does one explain
Moscow, Chicago, New York, and South Africa?

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


#39371

Fromchitselb <chitselb@gmail.com>
Date2015-05-27 22:04 -0700
Message-ID<0c12aefa-cc21-470d-837f-7462347b07e3@googlegroups.com>
In reply to#39366
On Wednesday, May 27, 2015 at 5:33:56 PM UTC-4, Rod Pemberton wrote:
> On Tue, 26 May 2015 00:13:44 -0400, <hugh...@gmail.com> wrote:
> > On Saturday, May 23, 2015 at 10:20:17 PM UTC-7, chitselb wrote:
> 
> >> Full disclosure:  I'm implementing this Forth on 1979 hardware  
> >> (Commodore PET 2001-N) so byte squeezing is a necessity and a retro  
> >> feel is okay.  I'm blending the various standards together in a way  
> >> that.
> >> A) makes sense to me
> >> B) shouldn't surprise another Forth programmer
> 
> Doesn't that mean fig-Forth? ...
> 
> > Why did you choose the PET? I suppose, because you had one.
> >
> > The Commodore-64 was much more popular --- if you did the C64, you
> > could find retro enthusiasts who would play with your Forth.
> 
> It seems he wants a challenge.  Perhaps, a VIC-20 would be better?
> Or, for an even more extreme challenge, perhaps an Altair 8800 or
> IMSAI 8080? ...
> 
> 
> Rod Pemberton
> -- 
> If fewer guns reduced murders, how does one explain
> Moscow, Chicago, New York, and South Africa?

Mostly because I have a PET, and it still works.  I'm developing in the VICE emulator, but it will be nice to have the PET available for the YouTube demo.

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


#39372

Fromrickman <gnuarm@gmail.com>
Date2015-05-28 01:27 -0400
Message-ID<mk68u7$hcd$1@dont-email.me>
In reply to#39371
On 5/28/2015 1:04 AM, chitselb wrote:
> On Wednesday, May 27, 2015 at 5:33:56 PM UTC-4, Rod Pemberton wrote:
>> On Tue, 26 May 2015 00:13:44 -0400, <hugh...@gmail.com> wrote:
>>> On Saturday, May 23, 2015 at 10:20:17 PM UTC-7, chitselb wrote:
>>
>>>> Full disclosure:  I'm implementing this Forth on 1979 hardware
>>>> (Commodore PET 2001-N) so byte squeezing is a necessity and a retro
>>>> feel is okay.  I'm blending the various standards together in a way
>>>> that.
>>>> A) makes sense to me
>>>> B) shouldn't surprise another Forth programmer
>>
>> Doesn't that mean fig-Forth? ...
>>
>>> Why did you choose the PET? I suppose, because you had one.
>>>
>>> The Commodore-64 was much more popular --- if you did the C64, you
>>> could find retro enthusiasts who would play with your Forth.
>>
>> It seems he wants a challenge.  Perhaps, a VIC-20 would be better?
>> Or, for an even more extreme challenge, perhaps an Altair 8800 or
>> IMSAI 8080? ...
>>
>>
>> Rod Pemberton
>> --
>> If fewer guns reduced murders, how does one explain
>> Moscow, Chicago, New York, and South Africa?
>
> Mostly because I have a PET, and it still works.  I'm developing in the VICE emulator, but it will be nice to have the PET available for the YouTube demo.

Hey!  You didn't answer the question, man.  So how do you explain 
*Moscow*?  Huh?  How about Chicago, New York, South frickin' Africa??? 
You got *any* answers???  Huh, do you?

Can you tell I'm watching a cop show...?

-- 

Rick

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


#39374

From"Rod Pemberton" <fork@lllljunkqwer.cpm>
Date2015-05-28 03:20 -0400
Message-ID<op.xzb3z5mewhxjl4@localhost>
In reply to#39372
On Thu, 28 May 2015 01:27:42 -0400, rickman <gnuarm@gmail.com> wrote:
> On 5/28/2015 1:04 AM, chitselb wrote:
>> On Wednesday, May 27, 2015 at 5:33:56 PM UTC-4, Rod Pemberton wrote:

>>> If fewer guns reduced murders, how does one explain
>>> Moscow, Chicago, New York, and South Africa?
>>
>> [...]
>
> Hey!  You didn't answer the question, man.  So how do you
> explain *Moscow*?  Huh?  How about Chicago, New York,
> South frickin' Africa???  You got *any* answers???  Huh,
> do you?
>

Since that was in my sig, which chitselb didn't trim, you
went off-topic ...

<OT,non-Forth>

I once read that a town is only as good as the people in it.
I.e., when it comes to murder, it's not guns which are the
problem as indicated by those cities which have low levels
of guns but high rates of murder.  It's the people in them.
They'll kill each other even without guns.  Liberals tend
to live in cities, are the people who are killing each other
with guns, and are also the same people who oppose guns.
It's American irony at it's finest.

E.g., my prior sig was:

> Cars kill more people than guns in the U.S.
> Yet, no one is trying to take away your car.

Liberals are insanely anti-gun in the U.S. for no apparently
logical reason.  How can I say that?  Because not one of them
has ever said a single word about deaths from traffic accidents
Traffic accidents are just as frequent as gun deaths.  However,
traffic accidents are a non-issue to them.  If vehicles
are just as deadly as guns, shouldn't they fear guns too?
Shouldn't they be petitioning and having rallies to ban
vehicles?  Shouldn't vehicle deaths be a top story on the
news?  If you truly believe that death by guns are the
problem, then why shouldn't vehicles which cause just as
many deaths be restricted or prohibited or banned too? ...
Liberals ignore this logical and rational argument.  They
won't even respond to it.  They know their anti-gun crusade
is irrational and not founded in facts.  If their crusade
was founded in facts, they'd have to oppose people driving
too, but they'll never give up the freedom of their cars
to reduce deaths.  Why should others give up the freedom
of their guns to reduce deaths?


Rod Pemberton
P.S. I'm not sure why nobody in this Usenet group trims signatures ...
-- 
If fewer guns reduced murders, how does one explain
Moscow, Chicago, New York, and South Africa?

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


#39375

Fromrickman <gnuarm@gmail.com>
Date2015-05-28 04:13 -0400
Message-ID<mk6il2$deb$1@dont-email.me>
In reply to#39374
On 5/28/2015 3:20 AM, Rod Pemberton wrote:
> On Thu, 28 May 2015 01:27:42 -0400, rickman <gnuarm@gmail.com> wrote:
>> On 5/28/2015 1:04 AM, chitselb wrote:
>>> On Wednesday, May 27, 2015 at 5:33:56 PM UTC-4, Rod Pemberton wrote:
>
>>>> If fewer guns reduced murders, how does one explain
>>>> Moscow, Chicago, New York, and South Africa?
>>>
>>> [...]
>>
>> Hey!  You didn't answer the question, man.  So how do you
>> explain *Moscow*?  Huh?  How about Chicago, New York,
>> South frickin' Africa???  You got *any* answers???  Huh,
>> do you?
>>
>
> Since that was in my sig, which chitselb didn't trim, you
> went off-topic ...
>
> <OT,non-Forth>
>
> I once read that a town is only as good as the people in it.
> I.e., when it comes to murder, it's not guns which are the
> problem as indicated by those cities which have low levels
> of guns but high rates of murder.  It's the people in them.
> They'll kill each other even without guns.  Liberals tend
> to live in cities, are the people who are killing each other
> with guns, and are also the same people who oppose guns.
> It's American irony at it's finest.
>
> E.g., my prior sig was:
>
>> Cars kill more people than guns in the U.S.
>> Yet, no one is trying to take away your car.
>
> Liberals are insanely anti-gun in the U.S. for no apparently
> logical reason.  How can I say that?  Because not one of them
> has ever said a single word about deaths from traffic accidents
> Traffic accidents are just as frequent as gun deaths.  However,
> traffic accidents are a non-issue to them.  If vehicles
> are just as deadly as guns, shouldn't they fear guns too?
> Shouldn't they be petitioning and having rallies to ban
> vehicles?  Shouldn't vehicle deaths be a top story on the
> news?  If you truly believe that death by guns are the
> problem, then why shouldn't vehicles which cause just as
> many deaths be restricted or prohibited or banned too? ...
> Liberals ignore this logical and rational argument.  They
> won't even respond to it.  They know their anti-gun crusade
> is irrational and not founded in facts.  If their crusade
> was founded in facts, they'd have to oppose people driving
> too, but they'll never give up the freedom of their cars
> to reduce deaths.  Why should others give up the freedom
> of their guns to reduce deaths?
>
>
> Rod Pemberton
> P.S. I'm not sure why nobody in this Usenet group trims signatures ...

I sabotaged Chit's newsreader just so you would have an excuse to go 
*way* off topic yourself.  That was quite the rant... almost a 
manifesto.   You know the kind of people who have manifestos, right?

You should try posting in s.e.d.  This sort of thing is pretty much de 
rigueur there.  Oh yeah, OT posting is the norm also.

-- 

Rick

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


#39399

From"Rod Pemberton" <fork@lllljunkqwer.cpm>
Date2015-05-29 04:23 -0400
Message-ID<op.xzd1k8m1whxjl4@localhost>
In reply to#39375
On Thu, 28 May 2015 04:13:29 -0400, rickman <gnuarm@gmail.com> wrote:

>> [OT]
>
> You should try posting in s.e.d.  This sort of thing is pretty much
> de rigueur there.  Oh yeah, OT posting is the norm also.
>

It's the norm here.  You do it all the time on microprocessors and
microcontrollers which are only trivially related to Forth, if that.
You're not the only one here who posts OT constantly either, e.g.,
Hugh, Bernd, etc.


Rod Pemberton

-- 
If fewer guns reduced murders, how does one explain
Moscow, Chicago, New York, and South Africa?

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


#39422

Fromrickman <gnuarm@gmail.com>
Date2015-05-29 11:28 -0400
Message-ID<mka0g0$4ir$1@dont-email.me>
In reply to#39399
On 5/29/2015 4:23 AM, Rod Pemberton wrote:
> On Thu, 28 May 2015 04:13:29 -0400, rickman <gnuarm@gmail.com> wrote:
>
>>> [OT]
>>
>> You should try posting in s.e.d.  This sort of thing is pretty much
>> de rigueur there.  Oh yeah, OT posting is the norm also.
>>
>
> It's the norm here.  You do it all the time on microprocessors and
> microcontrollers which are only trivially related to Forth, if that.
> You're not the only one here who posts OT constantly either, e.g.,
> Hugh, Bernd, etc.

Stack processors programmed with Forth are on topic here.  Personal 
manefestos are not.  Just own up to it and stop trying to deflect 
attention.

I'm sure you will continue to debate the issue with your usual means... 
also off topic.

-- 

Rick

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


#39436

From"Rod Pemberton" <fork@lllljunkqwer.cpm>
Date2015-05-29 18:32 -0400
Message-ID<op.xze4vsk6whxjl4@localhost>
In reply to#39422
On Fri, 29 May 2015 11:28:06 -0400, rickman <gnuarm@gmail.com> wrote:
> On 5/29/2015 4:23 AM, Rod Pemberton wrote:
>> On Thu, 28 May 2015 04:13:29 -0400, rickman <gnuarm@gmail.com> wrote:

>>>> [OT]
>>>
>>> You should try posting in s.e.d.  This sort of thing is pretty much
>>> de rigueur there.  Oh yeah, OT posting is the norm also.
>>>
>>
>> It's the norm here.  You do it all the time on microprocessors and
>> microcontrollers which are only trivially related to Forth, if that.
>> You're not the only one here who posts OT constantly either, e.g.,
>> Hugh, Bernd, etc.
>
> Stack processors programmed with Forth are on topic here.

Forth is on topic.  Microprocessors when discussing Forth usage
are on-topic.  Microprocessors and microcontroller discussion not
regarding Forth, even if they could use Forth, is not on-topic.
The latter constitutes the vast majority of your posts.

> Personal manefestos are not.

Criticisms of signatures are not either.
How F-word stupid do you have to be do that?

> Just own up to it and stop trying to deflect attention.

You shouldn't start shit and then blame others for it.  I
pointed out you were in the wrong and that's why you got
that response.

So, who was deflecting?  You!  You started the off-topic
response in-reply to a signature of all things ...  Do
you intend to own up to that?


Rod Pemberton
-- 
If fewer guns reduced murders, how does one explain
Moscow, Chicago, New York, and South Africa?

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


#39437

Fromrickman <gnuarm@gmail.com>
Date2015-05-29 18:53 -0400
Message-ID<mkaqit$bab$2@dont-email.me>
In reply to#39436
On 5/29/2015 6:32 PM, Rod Pemberton wrote:
> On Fri, 29 May 2015 11:28:06 -0400, rickman <gnuarm@gmail.com> wrote:
>> On 5/29/2015 4:23 AM, Rod Pemberton wrote:
>>> On Thu, 28 May 2015 04:13:29 -0400, rickman <gnuarm@gmail.com> wrote:
>
>>>>> [OT]
>>>>
>>>> You should try posting in s.e.d.  This sort of thing is pretty much
>>>> de rigueur there.  Oh yeah, OT posting is the norm also.
>>>>
>>>
>>> It's the norm here.  You do it all the time on microprocessors and
>>> microcontrollers which are only trivially related to Forth, if that.
>>> You're not the only one here who posts OT constantly either, e.g.,
>>> Hugh, Bernd, etc.
>>
>> Stack processors programmed with Forth are on topic here.
>
> Forth is on topic.  Microprocessors when discussing Forth usage
> are on-topic.  Microprocessors and microcontroller discussion not
> regarding Forth, even if they could use Forth, is not on-topic.
> The latter constitutes the vast majority of your posts.
>
>> Personal manefestos are not.
>
> Criticisms of signatures are not either.
> How F-word stupid do you have to be do that?
>
>> Just own up to it and stop trying to deflect attention.
>
> You shouldn't start shit and then blame others for it.  I
> pointed out you were in the wrong and that's why you got
> that response.
>
> So, who was deflecting?  You!  You started the off-topic
> response in-reply to a signature of all things ...  Do
> you intend to own up to that?

You are such a trip.  I'm glad I could make your day happier.  :)

I seriously doubt you will ever understand.

-- 

Rick

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


#39239

FromMichael Barry <barrym95838@yahoo.com>
Date2015-05-23 22:26 -0700
Message-ID<ad6f02c3-4081-46b9-8b9a-ca5c321f7c55@googlegroups.com>
In reply to#39237
On Saturday, May 23, 2015 at 10:10:32 PM UTC-7, hughag...@gmail.com wrote:
> ... 
>
> I'm pretty sure that DO loops go back to the very original Forth, so it
> was likely Charles Moore who came up with the idea.
> 
> ...

I meant the optimization, not the implementation.  You can check your
  Forth by comparing R@ and I inside a loop.  If they're equal, then
  there is no V-flag optimization.  If they're different, then it is
  likely present.

Mike

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


#39242

From"Elizabeth D. Rather" <erather@forth.com>
Date2015-05-23 21:37 -1000
Message-ID<moednUToyPo_4vzInZ2dnUU7-KmdnZ2d@supernews.com>
In reply to#39239
On 5/23/15 7:26 PM, Michael Barry wrote:
> On Saturday, May 23, 2015 at 10:10:32 PM UTC-7, hughag...@gmail.com wrote:
>> ...
>>
>> I'm pretty sure that DO loops go back to the very original Forth, so it
>> was likely Charles Moore who came up with the idea.
>>
>> ...
>
> I meant the optimization, not the implementation.  You can check your
>    Forth by comparing R@ and I inside a loop.  If they're equal, then
>    there is no V-flag optimization.  If they're different, then it is
>    likely present.

Yes, that was definitely a late 80's innovation. It was hotly contested 
during the Forth94 debate, but the TC couldn't resist an optimization.

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]


#39253

Fromhughaguilar96@gmail.com
Date2015-05-24 10:24 -0700
Message-ID<11e526ae-3d3a-4e92-bbc9-da83bc5d2888@googlegroups.com>
In reply to#39242
On Sunday, May 24, 2015 at 12:37:07 AM UTC-7, Elizabeth D. Rather wrote:
> On 5/23/15 7:26 PM, Michael Barry wrote:
> > I meant the optimization, not the implementation.  You can check your
> >    Forth by comparing R@ and I inside a loop.  If they're equal, then
> >    there is no V-flag optimization.  If they're different, then it is
> >    likely present.
> 
> Yes, that was definitely a late 80's innovation. It was hotly contested 
> during the Forth94 debate, but the TC couldn't resist an optimization.

One of the major failings of ANS-Forth was that they often couldn't resist to put "optimization" in the standard --- not realizing that optimizing compilers would be introduced in a few years that would take care of optimization transparently.

For example, we have these:

2>R ( a b -- )      \ return stack: -- a b          \ effectively: SWAP >R >R
2R> ( -- a b )      \ return stack: a b --          \ effectively: R> R> SWAP
2R@ ( -- a b )      \ return stack: a b -- a b      \ effectively: R> R>  2DUP >R >R  SWAP

This was an "optimization" in the sense that if a double-integer was pushed to the return-stack with 2>R then R@ would obtain the high-cell that can be used to test the sign of the double-integer. I've never seen this actually done, but it is theoretically possible, and somebody may someday need to test the sign of a double-integer on the return-stack in which case they will be saved from doing the SWAP explicitly.

Of course, this is totally baffling to the user who would intuitively expect 2>R to be the same as >R >R. A lot of people have tried to learn ANS-Forth, but have become confused by the weird and pointless "optimizations" such as this, and so they just gave up and went back to C programming.

As I have said many times before, ANS-Forth killed Forth --- and Forth Inc. is to blame, because ANS-Forth was purely a Forth Inc. marketing gimmick intended to convince the world that Forth Inc. sets the standard for all Forthers --- Elizabeth Rather was the super-salesperson who came up with this audacious marketing gimmick, so she is personally to blame for killing Forth.

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


#39263

From"Rod Pemberton" <fork@lllljunkqwer.cpm>
Date2015-05-24 20:40 -0400
Message-ID<op.xy51hvgmwhxjl4@localhost>
In reply to#39253
On Sun, 24 May 2015 13:24:56 -0400, <hughaguilar96@gmail.com> wrote:

> For example, we have these:
>
> 2>R ( a b -- )      \ return stack: -- a b
> \ effectively: SWAP >R >R
> 2R> ( -- a b )      \ return stack: a b --
> \ effectively: R> R> SWAP
> 2R@ ( -- a b )      \ return stack: a b -- a b
> \ effectively: R> R>  2DUP >R >R  SWAP
>

: 2R@ 2R> 2DUP 2>R ;
: 2R@ R> R> DUP >R SWAP DUP >R ;

Did you know that 2OVER and 2TUCK reduce to only 18 operations
in terms of >R R> SWAP DUP ?


Rod Pemberton
-- 
If fewer guns reduced murders, how does one explain
Moscow, Chicago, New York, and South Africa?

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


Page 5 of 8 — ← Prev page 1 2 3 4 [5] 6 7 8  Next page →

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


csiph-web