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


Groups > comp.lang.forth > #60391

Re: What is Forth anyway?

From Ron Aaron <rambamist@gmail.com>
Newsgroups comp.lang.forth
Subject Re: What is Forth anyway?
Date 2017-06-06 17:07 +0300
Organization A noiseless patient Spider
Message-ID <oh6cnj$2gh$1@dont-email.me> (permalink)
References (6 earlier) <xn0kqvmew9gdh02004@nntp.aioe.org> <8bf8061e-8cd7-4148-90ef-10e4fdb88531@googlegroups.com> <oh5t4q$c94$1@dont-email.me> <oh5tct$boq$1@dont-email.me> <2017Jun6.153434@mips.complang.tuwien.ac.at>

Show all headers | View raw



On 06/06/2017 16:34, Anton Ertl wrote:
> Ron Aaron <rambamist@gmail.com> writes:
>> Even though (for example) eliminating "DUP DROP" would normally be
>> considered a "safe optimization", how is the compiler to know if the
>> programmer *intended* that due to side-effects?
> 
> In Gforth, we actually have a visible side effect of that:
> 
> [b8:~/gforth:16424] gforth
> Gforth 0.7.9_20170406, Copyright (C) 1995-2016 Free Software Foundation, Inc.
> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> Type `help' for basic help
> : foo dup drop ;  ok
> foo 
> *the terminal*:2: error: Stack underflow
> foo
> Backtrace:
>                                          0 $7FB6F17E1350 dup 

8th does something similar:
dup drop

Exception: stack empty: at offset 4 in console: dup (G:;;; +000000f6)
Exception: stack empty: at offset 9 in console: drop (G:;;; +000000f6)


> 
> I very much doubt that any programmer actually *intends* this side
> effect.  However, when developing a program, they probably find it
> convenient to be notified of a stack underflow at the earliest
> opportunity, and that is why the debugging engine "gforth" disables
> stack caching completely: it would mask the stack underflow.  There is
> the benchmarking engine gforth-fast, which performs stack caching and
> masks this bug:
> 
> [b8:~/gforth:16425] gforth-fast
> Gforth 0.7.9_20170406, Copyright (C) 1995-2016 Free Software Foundation, Inc.
> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> Type `help' for basic help
> : foo dup drop ;  ok
> foo  ok
> 
> So, the answer to this question is: The compiler knows because the
> user actually called the appropriate compiler for his usage
> requirements.

Hmm.  Well, the Compiler I suppose (rather than user)...

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


Thread

What is Forth anyway? Brad Eckert <hwfwguy@gmail.com> - 2017-06-03 20:31 -0700
  Re: What is Forth anyway? lehs <skydda.barnen@gmail.com> - 2017-06-03 23:05 -0700
    Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-04 03:23 -0700
      Re: What is Forth anyway? lehs <skydda.barnen@gmail.com> - 2017-06-04 03:39 -0700
  Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-04 03:17 -0700
    Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-04 03:18 -0700
  What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-04 05:17 -0700
    Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-04 07:13 -0700
    Re: What is Forth anyway? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-06-05 02:38 -0500
  Re: What is Forth anyway? NN <november.nihal@gmail.com> - 2017-06-04 05:27 -0700
  Re: What is Forth anyway? "HAA" <someone@microsoft.com> - 2017-06-04 23:07 +1000
    Re: What is Forth anyway? Alex <alex@rivadpm.com> - 2017-06-04 19:12 +0100
      Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-04 12:55 -0700
        Re: What is Forth anyway? Alex <alex@rivadpm.com> - 2017-06-04 21:41 +0100
        Re: What is Forth anyway? "HAA" <someone@microsoft.com> - 2017-06-05 15:54 +1000
          Re: What is Forth anyway? Howerd <howerdo@yahoo.co.uk> - 2017-06-05 02:05 -0700
      Re: What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-04 17:33 -0700
        Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-05 12:54 +0000
    Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-04 22:14 +0000
      Re: What is Forth anyway? hughaguilar96@gmail.com - 2017-06-04 16:39 -0700
        Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-05 12:44 +0000
          Re: What is Forth anyway? hughaguilar96@gmail.com - 2017-06-05 08:10 -0700
            Re: What is Forth anyway? gavino himself <jackvanc3@gmail.com> - 2017-06-05 10:01 -0700
            Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-05 19:29 +0000
              Re: What is Forth anyway? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-06-06 03:44 -0500
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-07 19:26 +0000
                Re: What is Forth anyway? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-06-08 02:06 -0500
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-09 17:09 +0000
            Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-05 19:41 +0000
              Re: What is Forth anyway? lehs <skydda.barnen@gmail.com> - 2017-06-06 02:19 -0700
                Re: What is Forth anyway? Alex <alex@rivadpm.com> - 2017-06-06 10:41 +0100
                Re: What is Forth anyway? Ron Aaron <rambamist@gmail.com> - 2017-06-06 12:45 +0300
                Re: What is Forth anyway? Alex <alex@rivadpm.com> - 2017-06-06 11:23 +0100
                Re: What is Forth anyway? Ron Aaron <rambamist@gmail.com> - 2017-06-06 13:30 +0300
                Re: What is Forth anyway? Alex <alex@rivadpm.com> - 2017-06-06 12:55 +0100
                Re: What is Forth anyway? Ron Aaron <rambamist@gmail.com> - 2017-06-06 14:57 +0300
                Re: What is Forth anyway? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-06-06 13:34 +0000
                Re: What is Forth anyway? Ron Aaron <rambamist@gmail.com> - 2017-06-06 17:07 +0300
                Re: What is Forth anyway? Coos Haak <htrofhc@gmail.com> - 2017-06-06 16:51 +0200
                Re: What is Forth anyway? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-06-06 16:32 +0000
                Re: What is Forth anyway? Coos Haak <htrofhc@gmail.com> - 2017-06-07 01:37 +0200
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-07 19:29 +0000
                Re: What is Forth anyway? Cecil Bayona <cbayona@cbayona.com> - 2017-06-07 14:56 -0500
                Re: What is Forth anyway? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2017-06-06 04:48 -0500
                Re: What is Forth anyway? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-06-06 10:10 +0000
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-07 19:28 +0000
                Re: What is Forth anyway? Cecil Bayona <cbayona@cbayona.com> - 2017-06-07 14:54 -0500
                Re: What is Forth anyway? lehs <skydda.barnen@gmail.com> - 2017-06-07 19:42 -0700
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-09 17:12 +0000
      Re: What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-04 17:40 -0700
        Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-05 12:51 +0000
          Re: What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-05 17:19 -0700
            Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-07 19:32 +0000
              Re: What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-07 16:50 -0700
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-09 17:15 +0000
                Re: What is Forth anyway? Ilya Tarasov <ilya74.tarasov@gmail.com> - 2017-06-09 13:04 -0700
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-09 21:27 +0000
          Re: What is Forth anyway? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-06-06 10:19 +0000
            Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-07 19:38 +0000
              Re: What is Forth anyway? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2017-06-08 11:52 +0000
                Re: What is Forth anyway? "Rudy Velthuis" <newsgroups@rvelthuis.de> - 2017-06-09 17:23 +0000
  Re: What is Forth anyway? gavino himself <jackvanc3@gmail.com> - 2017-06-05 07:16 -0700
  Re: What is Forth anyway? gavino himself <jackvanc3@gmail.com> - 2017-06-05 07:35 -0700

csiph-web