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


Groups > comp.lang.forth > #59261

Re: Is it -2ROT or 2-ROT ?

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Is it -2ROT or 2-ROT ?
Date 2017-05-15 05:48 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2017May15.074817@mips.complang.tuwien.ac.at> (permalink)
References <20170513180058.4521f422@_> <7a24c976-96ef-497b-bb46-46116b8cb84e@googlegroups.com> <ofb7vi$elu$1@dont-email.me> <87shk6afxs.fsf@nightsong.com>

Show all headers | View raw


Paul Rubin <no.email@nospam.invalid> writes:
>I can never remember which
>direction is ROT and which is -ROT, and I suspect it's the same for
>(some) other users too.

All core stack manipulation in Forth is about getting something to the
TOS.  So ROT removes the third element and puts it on the TOS.

Interestingly, in the JVM the TUCK-like words that save a copy of the
TOS further down for later use are more prominent.

So the idea in Forth is that you have some data X lying around,
compute something else (Y), and then use SWAP or ROT or OVER to do
further things with X.

In contrast, in the JVM the idea is that you compute something (Z),
and continue the computation, but if you know that you need Z again,
you stash it away further down the stack.

I wonder if this is just a difference in style, or is related to the
fact that in Forth traditionally more data is kept on the stack, while
in the JVM more things are done with locals.

- 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 2017: http://www.euroforth.org/ef17/

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


Thread

Is it -2ROT or 2-ROT ? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2017-05-13 18:00 -0400
  Re: Is it -2ROT or 2-ROT ? Julian Fondren <julian.fondren@gmail.com> - 2017-05-13 15:19 -0700
  Re: Is it -2ROT or 2-ROT ? "Elizabeth D. Rather" <erather@forth.com> - 2017-05-13 13:21 -1000
  Re: Is it -2ROT or 2-ROT ? "HAA" <someone@microsoft.com> - 2017-05-14 11:23 +1000
  Is it -2ROT or 2-ROT ? Mark Wills <markwills1970@gmail.com> - 2017-05-14 00:34 -0700
    Re: Is it -2ROT or 2-ROT ? "HAA" <someone@microsoft.com> - 2017-05-15 10:12 +1000
    Re: Is it -2ROT or 2-ROT ? rickman <gnuarm@gmail.com> - 2017-05-14 23:43 -0400
      Re: Is it -2ROT or 2-ROT ? "HAA" <someone@microsoft.com> - 2017-05-15 13:47 +1000
        Re: Is it -2ROT or 2-ROT ? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-05-15 09:51 +0000
      Re: Is it -2ROT or 2-ROT ? Paul Rubin <no.email@nospam.invalid> - 2017-05-14 21:42 -0700
        Re: Is it -2ROT or 2-ROT ? Julian Fondren <julian.fondren@gmail.com> - 2017-05-14 22:17 -0700
          Re: Is it -2ROT or 2-ROT ? Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem> - 2017-05-15 17:57 -0400
            Re: Is it -2ROT or 2-ROT ? Julian Fondren <julian.fondren@gmail.com> - 2017-05-15 15:49 -0700
            Re: Is it -2ROT or 2-ROT ? rickman <gnuarm@gmail.com> - 2017-05-16 02:16 -0400
              Re: Is it -2ROT or 2-ROT ? Joel Rees <joel.rees@gmail.com> - 2017-05-16 19:54 -0700
                Re: Is it -2ROT or 2-ROT ? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-17 08:11 +0200
                Re: Is it -2ROT or 2-ROT ? stephen@mpeforth.com (Stephen Pelc) - 2017-05-17 11:09 +0000
            Re: Is it -2ROT or 2-ROT ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-16 03:53 -0500
        Re: Is it -2ROT or 2-ROT ? rickman <gnuarm@gmail.com> - 2017-05-15 01:21 -0400
          Re: Is it -2ROT or 2-ROT ? Cecil Bayona <cbayona@cbayona.com> - 2017-05-15 00:30 -0500
            Re: Is it -2ROT or 2-ROT ? Julian Fondren <julian.fondren@gmail.com> - 2017-05-14 22:40 -0700
              Re: Is it -2ROT or 2-ROT ? Mark Wills <markwills1970@gmail.com> - 2017-05-15 02:06 -0700
            Re: Is it -2ROT or 2-ROT ? hughaguilar96@gmail.com - 2017-05-15 22:45 -0700
          Re: Is it -2ROT or 2-ROT ? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-15 09:05 +0200
            Re: Is it -2ROT or 2-ROT ? Mark Wills <markwills1970@gmail.com> - 2017-05-15 02:11 -0700
          Re: Is it -2ROT or 2-ROT ? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-05-15 09:52 +0000
        Re: Is it -2ROT or 2-ROT ? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-05-15 05:48 +0000
          Re: Is it -2ROT or 2-ROT ? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-05-15 05:14 -0500
          Re: Is it -2ROT or 2-ROT ? stephen@mpeforth.com (Stephen Pelc) - 2017-05-15 11:40 +0000
        Re: Is it -2ROT or 2-ROT ? Mark Wills <markwills1970@gmail.com> - 2017-05-15 02:03 -0700
        Re: Is it -2ROT or 2-ROT ? albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2017-05-15 21:24 +0200
        Re: Is it -2ROT or 2-ROT ? "HAA" <someone@microsoft.com> - 2017-05-16 09:57 +1000
          Re: Is it -2ROT or 2-ROT ? Lars Brinkhoff <lars.spam@nocrew.org> - 2017-05-16 08:09 +0200
            Re: Is it -2ROT or 2-ROT ? "HAA" <someone@microsoft.com> - 2017-05-17 00:54 +1000

csiph-web