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


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

3rd RfD: Quotations

Started byanton@mips.complang.tuwien.ac.at (Anton Ertl)
First post2016-07-01 16:10 +0000
Last post2016-08-12 11:05 -0700
Articles 20 on this page of 151 — 25 participants

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


Contents

  3rd RfD: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-01 16:10 +0000
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-01 11:21 -0700
      Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-01 11:58 -0700
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-01 12:53 -0700
          Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-01 16:05 -0400
            Re: 3rd RfD: Quotations Cecil Bayona <cbayona@cbayona.com> - 2016-07-01 19:00 -0500
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-01 18:22 -0700
                Re: 3rd RfD: Quotations Cecil Bayona <cbayona@cbayona.com> - 2016-07-01 21:16 -0500
                Re: 3rd RfD: Quotations Wasell <from_usenet@wasell.eu> - 2016-07-02 13:04 +0200
                  Re: 3rd RfD: Quotations Cecil Bayona <cbayona@cbayona.com> - 2016-07-02 09:39 -0500
                    Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-02 16:33 +0100
                      Re: 3rd RfD: Quotations Cecil Bayona <cbayona@cbayona.com> - 2016-07-02 11:50 -0500
                        Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-02 10:45 -0700
                          Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-02 19:24 -0400
                          Re: 3rd RfD: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-07-03 11:48 +0100
                            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-03 07:08 -0700
                              Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-03 11:49 -0400
                            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-04 08:25 -0700
                              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-04 16:57 -0700
                                Re: 3rd RfD: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-07-05 07:40 +0100
                                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-05 01:38 -0700
                                Re: 3rd RfD: Quotations alex@rivadpm.com - 2016-07-05 01:33 -0700
                                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-05 02:28 -0700
                                    Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-05 10:06 -0400
                                    Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-05 20:57 +0100
                                      Re: 3rd RfD: Quotations Ron Aaron <rambamist@gmail.com> - 2016-07-06 00:12 +0300
                                        Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-05 22:45 +0100
                                          Re: 3rd RfD: Quotations Ron Aaron <rambamist@gmail.com> - 2016-07-06 10:50 +0300
                                          Re: 3rd RfD: Quotations Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-06 03:31 -0500
                                      Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-08 09:07 -0700
                              Re: 3rd RfD: Quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-07-04 21:08 +0100
                          Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-04 09:10 -0700
                        Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-02 19:24 +0100
                          Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-02 16:19 -0700
                            Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-02 23:18 -0400
                              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-02 21:54 -0700
                                Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-03 03:10 -0400
                                Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-03 09:35 +0100
                        Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-02 19:19 -0400
                          Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-03 01:45 -0700
                            Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-03 11:52 -0400
              Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-02 19:10 -0400
                Re: 3rd RfD: Quotations "Elizabeth D. Rather" <erather@forth.com> - 2016-07-02 13:27 -1000
                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-02 16:54 -0700
                    Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-02 23:27 -0400
                  Re: 3rd RfD: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-05 00:30 +0000
          Re: 3rd RfD: Quotations "HAA" <someone@microsoft.com> - 2016-07-08 21:15 +1000
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-08 07:39 -0700
              Re: 3rd RfD: Quotations "HAA" <someone@microsoft.com> - 2016-07-09 17:08 +1000
                Re: 3rd RfD: Quotations "Elizabeth D. Rather" <erather@forth.com> - 2016-07-08 23:22 -1000
        Re: 3rd RfD: Quotations "HAA" <someone@microsoft.com> - 2016-07-08 20:42 +1000
      Re: 3rd RfD: Quotations Alex McDonald <alex@rivadpm.com> - 2016-07-01 21:51 +0100
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-01 17:57 -0700
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-01 18:47 -0700
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-02 07:55 -0700
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-04 17:03 -0700
      Re: 3rd RfD: Quotations alex@rivadpm.com - 2016-07-05 01:38 -0700
      Re: 3rd RfD: Quotations rickman <gnuarm@gmail.com> - 2016-07-05 10:16 -0400
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-05 10:48 -0700
          Re: 3rd RfD: Quotations Coos Haak <chforth@hccnet.nl> - 2016-07-05 20:18 +0200
        Re: 3rd RfD: Quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-05 00:42 +0000
          Re: 3rd RfD: Quotations julian.fondren@endurance.com - 2016-08-04 19:44 -0700
    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-06 21:01 -0700
      Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-07 07:54 +0000
      Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-08 08:17 -0700
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-08 08:41 -0700
          Re: 3rd RfD: Quotations Julian Fondren <ayrnieu@gmail.com> - 2016-07-08 10:21 -0700
      Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-08 14:29 -0700
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-08 22:28 -0700
          Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-09 03:56 -0700
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-09 09:51 -0700
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-13 01:25 -0700
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-13 01:56 -0700
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-13 02:09 -0700
              Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-13 14:04 +0000
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-14 00:32 -0700
                Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-14 01:25 -0700
                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-16 14:52 -0700
                    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-16 20:25 -0700
                    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-18 12:46 -0700
                      Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-18 14:38 -0700
                        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-18 16:03 -0700
                    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-18 17:27 -0700
                Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-14 02:46 -0700
                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-15 08:33 -0700
                    Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-15 16:59 +0000
                  Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-15 23:30 -0700
                    Universal Delimiters - was Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-16 02:42 -0700
                      Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-16 05:47 -0700
                        Re: Universal Delimiters - was Re: 3rd RfD: Quotations Coos Haak <chforth@hccnet.nl> - 2016-07-16 15:41 +0200
                          Re: Universal Delimiters - was Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-16 07:16 -0700
                            Re: Universal Delimiters - was Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-16 07:27 -0700
                            Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-16 09:52 -0700
                              Re: Universal Delimiters - was Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-16 11:46 -0700
                                Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-17 03:11 -0700
                                  Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-17 03:18 -0700
                                  Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-17 03:47 -0700
                                    Re: Universal Delimiters - was Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-17 05:43 -0700
                                      Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-17 06:00 -0700
                                    Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-17 08:32 -0700
                                      Re: Universal Delimiters - was Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-17 23:49 -0700
                                        Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-18 00:39 -0700
                          Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-16 07:57 -0700
                            Re: Universal Delimiters - was Re: 3rd RfD: Quotations Coos Haak <chforth@hccnet.nl> - 2016-07-18 12:18 +0200
                              Re: Universal Delimiters - was Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-18 04:04 -0700
          Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-10 21:23 -0700
        Re: 3rd RfD: Quotations Lars Brinkhoff <lars.spam@nocrew.org> - 2016-07-09 14:30 +0200
          Re: 3rd RfD: Quotations mhx@iae.nl - 2016-07-09 05:51 -0700
            Re: 3rd RfD: Quotations Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-09 09:01 -0500
              Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-09 07:40 -0700
                Re: 3rd RfD: Quotations Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-07-09 12:27 -0500
                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-09 11:24 -0700
                Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-30 02:03 -0700
            Re: 3rd RfD: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-09 14:36 +0000
    Re: 3rd RfD: Quotations Håkan Thörngren <hth313@gmail.com> - 2016-07-09 12:58 -0700
      Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-09 21:59 -0700
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-09 23:11 -0700
          Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-10 00:14 -0700
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-12 01:06 -0700
              Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-12 05:31 -0700
                Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-12 09:00 -0700
                  Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-13 03:44 -0700
                    Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-13 11:36 -0700
                      Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-13 23:03 -0700
                    Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-07-14 01:23 -0700
                Re: 3rd RfD: Quotations "Elizabeth D. Rather" <erather@forth.com> - 2016-07-12 08:57 -1000
                  Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-12 22:53 -0700
          Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-11 01:09 +0000
            Re: 3rd RfD: Quotations Paul Rubin <no.email@nospam.invalid> - 2016-07-10 18:18 -0700
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-11 01:35 -0700
            Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-10 18:18 -0700
            Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-11 08:24 +0000
        Re: 3rd RfD: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-10 06:53 +0000
          Re: 3rd RfD: Quotations Håkan Thörngren <hth313@gmail.com> - 2016-07-10 00:53 -0700
            Re: 3rd RfD: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-10 16:57 +0000
          Re: 3rd RfD: Quotations franck.bensusan@gmail.com - 2016-07-10 02:26 -0700
            Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-10 06:49 -0700
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-10 11:04 -0700
                Re: 3rd RfD: Quotations JennyB <jennybrien@googlemail.com> - 2016-07-10 12:51 -0700
                  Re: 3rd RfD: Quotations franck.bensusan@gmail.com - 2016-07-10 13:21 -0700
                Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-07-10 13:23 -0700
    3rd RfD: Quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-28 16:56 +0000
      Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-07-28 16:29 -0700
        Re: 3rd RfD: Quotations "WJ" <w_a_x_man@yahoo.com> - 2016-07-29 00:50 +0000
        Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-08-11 12:15 -0700
          Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-08-11 13:25 -0700
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-08-11 20:57 -0700
          Re: 3rd RfD: Quotations humptydumpty <ouatubi@gmail.com> - 2016-08-11 13:59 -0700
            Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-08-11 21:11 -0700
              Re: 3rd RfD: Quotations Julian Fondren <julian.fondren@gmail.com> - 2016-08-12 00:30 -0700
              Re: 3rd RfD: Quotations hughaguilar96@gmail.com - 2016-08-12 11:05 -0700

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


#49077

Fromhughaguilar96@gmail.com
Date2016-07-12 09:00 -0700
Message-ID<2296e4c4-45be-4ddd-abd9-a4213a92f811@googlegroups.com>
In reply to#49074
On Tuesday, July 12, 2016 at 5:32:03 AM UTC-7, JennyB wrote:
> > variable pfq  ok
> > : foo  ahead [ :noname ." a" ; pfq ! ] then [ pfq @ ] literal ;  ok
> > foo 
> > Err# -13 ERR: Undefined word.
> >  -> foo
> >       ^
> > 
> > And here it is in SwiftForth:
> > 
> > variable pfq  ok
> > : foo  ahead [ :noname ." a" ; pfq ! ] then [ pfq @ ] literal ;  Unbalanced control structure
> > 
> > 
> > Honestly, I don't really know why this doesn't work. ANS-Forth is pretty mysterious! Apparently MPE and Forth Inc. don't know "why" either, because they each say that it doesn't work for different reasons. In VFX the ; for FOO apparently doesn't unsmudge FOO --- most likely because it tries to unsmudge the last definition which isn't FOO --- but this doesn't make sense because the last definition was :NONAME which doesn't build a dictionary header, so it makes no sense that this is what ; would try to unsmudge. In SwiftForth we get an "unbalanced control structure" error --- but this doesn't make sense because the xt has been removed from the stack, so when THEN executes it should have the AHEAD stuff on the stack and be fine.
> 
> Julian was not saying it would or should work, only that if we want quotations we need both :NONAME and [: .
> 
> There may be some Forth's on which it does work, but it should not be expected. It leaves two definitions open at the same time, so how does : know which to close? It is not designed to deal with nested definitions. 
> 
> Knowing that, perhaps the simplest method of implementing : is to have it sotre the address of the header in a global variable, which ; can use later to make it visible. It does not need to be re-entrant.
> 
> The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter.
> 
> As you say yourself, the programmer should only have to deal with the interface, not the nuts and bolts. The interface is clearly that ; only has to deal with one open definition. 
> 
> 
> So, assuming the implementation to be something like the above: 
> 
> The :NONAME compiles correctly, but at this stage the address of Foo's header is lost, so it cannot be unsmudged.
> 
> In VFX the whole definition compiles, but Foo remains hidden.
> SwiftForth has more compiler security. I expect it distinguishes between colon-sys left by : and colon-sys left by :NONAME The final ; sees the discrepency (a header expected but an invalid address) and throws a control structure error.
> 
>  
> > My own VFX and SwiftForth code that I provided earlier, and which when tested did work, is not guaranteed to continue working in future versions of VFX and SwiftForth --- for one thing, an optimizing compiler might discard all of the code between AHEAD and THEN as being dead code that can't be reached --- Leon Wagner and Stephen Pelc might do this on purpose to make my code stop working, then say that it was my fault for writing non-standard code.
> 
> What a compiler does with code that does not conform to the published interface is entirely up to the compiler writer. The standard is the interface, not the nuts and bolts of the compiler code. That's the way it has to be if code is to run on more than compiler. And that's why compiler writers don't like to talk about implementation-specific details - if people program to the implementation rather than the interface, and feel justified in complaining when their code breaks, then the compiler cannot evolve.

You said: 
"...if we want quotations we need both :NONAME and [: ." 

That is not true --- my code doesn't need :NONAME at all --- my code provides quotations that have access to the parent function's locals, and also provides HOFs that have their own locals (what's not to love?).

You said: 
"The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter."

So, you believe that the simplest way to implement quotations is to alter how :NONAME is written. So, if you force all the compiler-writers to modify their compilers in this way, then you get Paysan-faked quotations that are useless because they don't have access to the parent's local variables.

Wouldn't it be simpler to just leave the compilers alone and not alter anything, so my code continues to work? All you need to do is make a rule stating that the code between AHEAD and THEN has to be compiled even if it seems to be unreachable, which all the ANS-Forth compilers do anyway right now. Also, you need to make a rule stating that the return address is held on the return-stack, which all the ANS-Forth compilers do anyway right now. Also, you need to define a constant which is the size of the AHEAD code (5 for SwiftForth or VFX and 8 for gForth) so my code doesn't have this magic-number in the middle of the code but can get it from a standardized constant. So, if you don't modify any compilers, then you get real quotations that are useful because they have access to the parent's local variables.

It makes no sense for the Forth-200x committee to require modification of all ANS-Forth compilers so they can get Paysan-faked quotations, when they can instead have real quotations without making any modifications at all but just stating that they are going to hold to what they currently have --- I provided working code that is useful!!! --- but you prefer Julian Fondren's fantasies instead, which even if they got implemented would be useless.

I wrote my code as a joke, because it shines a spotlight on the fact that not making sense is the hallmark of a cult. The punchline to the joke is when a cult member (you so far) struggles against reality with specious arguments. The loyal cult members just pretend that reality doesn't exist and focus their minds entirely on fantasy that would be useless even if all the compilers were altered thusly --- if you are going to be a loyal Forth-200x cult member, you have to abandon critical thinking, grin idiotically, and chug-a-lug the Kool-Aid --- it is very foolish to try to present technical arguments for why drinking the Kool-Aid is a good idea, because it is obviously not a good idea.

Anybody who writes Forth code that works will derail the Forth-200x happy-train --- every cult fears and avoids facing reality --- this is why all of the other Forth-200x cult members just pretend that my working code doesn't exist.

You remind me of the main character in the movie: "Population 436." Early in the movie, one boy in town told him that he looked like somebody who had "the Fever" and who needed to be treated for it by Dr. Greaver (the treatment is a lobotomy, we find out later). The man asked: "What do people with the Fever look like?" The boy told him: "They look like you!"

I predict that you will abandon Forth-200x pretty soon --- you think too much, but Forth-200x is not for thinking, it is for loyalty --- even if you abandon Forth-200x however, the Forth-200x document will still list your name as a supporter just as they still list my name as a supporter (you can check out any time you like, but you can never leave).

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


#49111

FromJennyB <jennybrien@googlemail.com>
Date2016-07-13 03:44 -0700
Message-ID<8ca345f5-63b7-4771-925c-18003224aee7@googlegroups.com>
In reply to#49077
On Tuesday, 12 July 2016 17:00:20 UTC+1, hughag...@gmail.com  wrote:

> You said: 
> "The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter."

That, and Julians post, was in response to Hakan's query as to whether we needed both words, of if one would do, with the compilation behavior of [: and the interpretation behavior of :NONAME. I think you will agree that would not be a good idea.

Neither of us were suggesting the code give as a way of implementing PFQs, nor that the implementation of :NONAME should be altered. Any compiler writer is free to implement [: or :NONAME or any word however they see fit, so long as it does what is expected of it according to the specification. 

The specification may declare something to be an "ambiguous condition," which means it does not wish to specify what happens in that situation, possibly because different Forths already handle it in different ways. If your compiler can do something useful with it, than it may do so, but don't expect other compilers to do the same thing.
> 

> Wouldn't it be simpler to just leave the compilers alone and not alter anything, so my code continues to work? All you need to do is make a rule stating that the code between AHEAD and THEN has to be compiled even if it seems to be unreachable, which all the ANS-Forth compilers do anyway right now. 

So, no compiler may eliminate unreachable code? That might, rule out Forth-in-language-X.

>Also, you need to make a rule stating that the return address is held on the return-stack, which all the ANS-Forth compilers do anyway right now. 

As I recall, that was done because some Forths at the time (early Windows) had a return address of more than one cell. If there are no more such Forths in use, then maybe they would consider making that an entitlement. But code that plays around control flow on the return stack has a stack of gotchas of its own.

>Also, you need to define a constant which is the size of the AHEAD code (5 for SwiftForth or VFX and 8 for gForth) so my code doesn't have this magic-number in the middle of the code but can get it from a standardized constant.

You really want that as part of the language spec?

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


#49121

Fromhughaguilar96@gmail.com
Date2016-07-13 11:36 -0700
Message-ID<72d494b2-439a-443c-a45e-54745cdbe4aa@googlegroups.com>
In reply to#49111
On Wednesday, July 13, 2016 at 3:44:56 AM UTC-7, JennyB wrote:
> On Tuesday, 12 July 2016 17:00:20 UTC+1, hughag...@gmail.com  wrote:
> 
> > You said: 
> > "The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter."
> 
> That, and Julians post, was in response to Hakan's query as to whether we needed both words, of if one would do, with the compilation behavior of [: and the interpretation behavior of :NONAME. I think you will agree that would not be a good idea.
> 
> Neither of us were suggesting the code give as a way of implementing PFQs, nor that the implementation of :NONAME should be altered. Any compiler writer is free to implement [: or :NONAME or any word however they see fit, so long as it does what is expected of it according to the specification. 
> 
> The specification may declare something to be an "ambiguous condition," which means it does not wish to specify what happens in that situation, possibly because different Forths already handle it in different ways. If your compiler can do something useful with it, than it may do so, but don't expect other compilers to do the same thing.

How are you going to make the Paysan-faked quotations part of Forth-200x without allowing :NONAME to be done inside of [ ] in the parent function? You have to do this --- this is the definition of what a PFQ is --- the PFQ has always been described in the RfD as syntactic sugar for :NONAME .

> > Wouldn't it be simpler to just leave the compilers alone and not alter anything, so my code continues to work? All you need to do is make a rule stating that the code between AHEAD and THEN has to be compiled even if it seems to be unreachable, which all the ANS-Forth compilers do anyway right now. 
> 
> So, no compiler may eliminate unreachable code? That might, rule out Forth-in-language-X.

The compiler-writer can meet this rule --- if he can't, then forget about him --- this is a trivial restriction.

> >Also, you need to make a rule stating that the return address is held on the return-stack, which all the ANS-Forth compilers do anyway right now. 
> 
> As I recall, that was done because some Forths at the time (early Windows) had a return address of more than one cell. If there are no more such Forths in use, then maybe they would consider making that an entitlement. But code that plays around control flow on the return stack has a stack of gotchas of its own.

I'm not aware of any gotchas at all --- it seems easy to me --- this is a trivial restriction on all modern computers that will bother nobody.

This won't work on some micro-controllers, such as the AVR. The stack for return-addresses is too small (32 elements) to hold >R data, and there is no indexed addressing-mode for the stack-pointer. On the AVR the r-stack that >R etc. use would be a register-pair distinct from the stack where return-addresses are held. This doesn't bother me for Straight Forth though --- I have said many times that Straight Forth is only for desktop-computers and is 64-bit --- LFTforth is for micro-controllers, but that is Raimond's thing not mine, so LFTforth would have to deal with the issue (Raimond doesn't use this HumptyDumpty code with its return-stack ticks but has something much simpler built-in to the compiler; functions are compiled into the heap, so the quotation doesn't have to be compiled into the middle of the parent function with an AHEAD jumping over it).

Straight Forth could be used to cross-compile LFTforth (that is the "killer-app" for Straight Forth), but Straight Forth is not even close to being compatible with LFTforth.

> >Also, you need to define a constant which is the size of the AHEAD code (5 for SwiftForth or VFX and 8 for gForth) so my code doesn't have this magic-number in the middle of the code but can get it from a standardized constant.
> 
> You really want that as part of the language spec?

I don't care what goes in the Forth-200x language spec --- I already know that the Paysan-faked quotations were pre-approved by Leon Wagner and all of this discussion is pointless --- the point of the Forth-200x mailing list is to collect names of supporters, but the supporters opinions aren't listened to. Leon Wagner has never backed down after killing an RfD --- he has already killed this RfD --- you don't see him participating in this discussion on the mailing list since the time that he killed this RfD (I doubt that he is even reading the thread any more).

I just wrote my code as a joke to make Forth-200x look ridiculous --- what the Committee of Can't says is impossible, I do easily...

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


#49141

Fromhughaguilar96@gmail.com
Date2016-07-13 23:03 -0700
Message-ID<ac017a49-ea2b-4204-b188-5816f24c098e@googlegroups.com>
In reply to#49121
On Wednesday, July 13, 2016 at 11:36:40 AM UTC-7, hughag...@gmail.com wrote:
> I don't care what goes in the Forth-200x language spec --- I already know that the Paysan-faked quotations were pre-approved by Leon Wagner and all of this discussion is pointless --- the point of the Forth-200x mailing list is to collect names of supporters, but the supporters opinions aren't listened to. Leon Wagner has never backed down after killing an RfD --- he has already killed this RfD --- you don't see him participating in this discussion on the mailing list since the time that he killed this RfD (I doubt that he is even reading the thread any more).

I said this wrong. I meant that Leon Wagner has already approved this RfD, not killed it.

It was Anton Ertl's RfD trying to fix ANS-Forth's bizarre number syntax that Leon Wagner killed.

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


#49152

Fromhumptydumpty <ouatubi@gmail.com>
Date2016-07-14 01:23 -0700
Message-ID<3da30cc0-12f2-441c-8329-65a363381764@googlegroups.com>
In reply to#49111
On Wednesday, July 13, 2016 at 1:44:56 PM UTC+3, JennyB wrote:
> On Tuesday, 12 July 2016 17:00:20 UTC+1, hughag...@gmail.com  wrote:
> 
> > You said: 
> > "The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter."
> 
> That, and Julians post, was in response to Hakan's query as to whether we needed both words, of if one would do, with the compilation behavior of [: and the interpretation behavior of :NONAME. I think you will agree that would not be a good idea.
> 
> Neither of us were suggesting the code give as a way of implementing PFQs, nor that the implementation of :NONAME should be altered. Any compiler writer is free to implement [: or :NONAME or any word however they see fit, so long as it does what is expected of it according to the specification. 
> 
> The specification may declare something to be an "ambiguous condition," which means it does not wish to specify what happens in that situation, possibly because different Forths already handle it in different ways. If your compiler can do something useful with it, than it may do so, but don't expect other compilers to do the same thing.
> > 
> 
> > Wouldn't it be simpler to just leave the compilers alone and not alter anything, so my code continues to work? All you need to do is make a rule stating that the code between AHEAD and THEN has to be compiled even if it seems to be unreachable, which all the ANS-Forth compilers do anyway right now. 
> 
> So, no compiler may eliminate unreachable code? That might, rule out Forth-in-language-X.
> 
> >Also, you need to make a rule stating that the return address is held on the return-stack, which all the ANS-Forth compilers do anyway right now. 
> 
> As I recall, that was done because some Forths at the time (early Windows) had a return address of more than one cell. If there are no more such Forths in use, then maybe they would consider making that an entitlement. But code that plays around control flow on the return stack has a stack of gotchas of its own.
> 
> >Also, you need to define a constant which is the size of the AHEAD code (5 for SwiftForth or VFX and 8 for gForth) so my code doesn't have this magic-number in the middle of the code but can get it from a standardized constant.
> 
> You really want that as part of the language spec?

Hi!

> 
> As I recall, that was done because some Forths at the time (early Windows) had a return address of more than one cell. If there are no more such Forths in use, then maybe they would consider making that an entitlement. But code that plays around control flow on the return stack has a stack of gotchas of its own.
> 

Rquotations are return-stack-continuations made easy and safe:

include rquotations.fs
: test
	17 >r 19 >r
	r[ 23 >r 1 . r> . ]r dup
	rcall ( rex ) cr r> . cr 29 >r rcall ( rex ) cr r> . cr r> . cr
;

cr test .s 
1 23 
19 
1 23 
29 
17 
<0>  ok

Have a nice day,
humptydumpty

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


#49082

From"Elizabeth D. Rather" <erather@forth.com>
Date2016-07-12 08:57 -1000
Message-ID<0_ydnXhUDZAToBjKnZ2dnUU7-QXNnZ2d@supernews.com>
In reply to#49074
On 7/12/16 2:31 AM, JennyB wrote:
>
>> variable pfq  ok
>> : foo  ahead [ :noname ." a" ; pfq ! ] then [ pfq @ ] literal ;  ok
>> foo
>> Err# -13 ERR: Undefined word.
>>  -> foo
>>       ^
>>
>> And here it is in SwiftForth:
>>
>> variable pfq  ok
>> : foo  ahead [ :noname ." a" ; pfq ! ] then [ pfq @ ] literal ;  Unbalanced control structure
>>
>>
>> Honestly, I don't really know why this doesn't work. ANS-Forth is pretty mysterious! Apparently MPE and Forth Inc. don't know "why" either, because they each say that it doesn't work for different reasons. In VFX the ; for FOO apparently doesn't unsmudge FOO --- most likely because it tries to unsmudge the last definition which isn't FOO --- but this doesn't make sense because the last definition was :NONAME which doesn't build a dictionary header, so it makes no sense that this is what ; would try to unsmudge. In SwiftForth we get an "unbalanced control structure" error --- but this doesn't make sense because the xt has been removed from the stack, so when THEN executes it should have the AHEAD stuff on the stack and be fine.
>
> Julian was not saying it would or should work, only that if we want quotations we need both :NONAME and [: .
>
> There may be some Forth's on which it does work, but it should not be expected. It leaves two definitions open at the same time, so how does : know which to close? It is not designed to deal with nested definitions.
>
> Knowing that, perhaps the simplest method of implementing : is to have it sotre the address of the header in a global variable, which ; can use later to make it visible. It does not need to be re-entrant.
>
> The sinmplest way to implement :NONAME then is to store the address of a dummy header which can be harmlessly 'revealed.' The code for ; does not need to alter.
>
> As you say yourself, the programmer should only have to deal with the interface, not the nuts and bolts. The interface is clearly that ; only has to deal with one open definition.
>
>
> So, assuming the implementation to be something like the above:
>
> The :NONAME compiles correctly, but at this stage the address of Foo's header is lost, so it cannot be unsmudged.
>
> In VFX the whole definition compiles, but Foo remains hidden.
> SwiftForth has more compiler security. I expect it distinguishes between colon-sys left by : and colon-sys left by :NONAME The final ; sees the discrepency (a header expected but an invalid address) and throws a control structure error.
>
>
>> My own VFX and SwiftForth code that I provided earlier, and which when tested did work, is not guaranteed to continue working in future versions of VFX and SwiftForth --- for one thing, an optimizing compiler might discard all of the code between AHEAD and THEN as being dead code that can't be reached --- Leon Wagner and Stephen Pelc might do this on purpose to make my code stop working, then say that it was my fault for writing non-standard code.
>
> What a compiler does with code that does not conform to the published interface is entirely up to the compiler writer. The standard is the interface, not the nuts and bolts of the compiler code. That's the way it has to be if code is to run on more than compiler. And that's why compiler writers don't like to talk about implementation-specific details - if people program to the implementation rather than the interface, and feel justified in complaining when their code breaks, then the compiler cannot evolve.

The subject of nested definitions was discussed at length in the Forth94 
deliberations. The result was:

	3.4.5 Compilation
	A program shall not attempt to nest compilation of definitions.

The TC concluded that the implementation requirements necessary for 
allowing nested definitions were both too complex to be worked out to 
complete satisfaction in a reasonable time frame, and too limiting on 
compiler technology. You can certainly have a go at it if you wish, but 
I suspect you may find that to be true still.

Of course, you are certainly free to implement such a facility in your 
own system, and if your users love it others may be inspired to follow 
suit in the future.

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]


#49106

Fromhughaguilar96@gmail.com
Date2016-07-12 22:53 -0700
Message-ID<425228e8-80e8-424f-a224-4dbc4ab2262b@googlegroups.com>
In reply to#49082
On Tuesday, July 12, 2016 at 11:57:24 AM UTC-7, Elizabeth D. Rather wrote:
> On 7/12/16 2:31 AM, JennyB wrote:
> The subject of nested definitions was discussed at length in the Forth94 
> deliberations. The result was:
> 
> 	3.4.5 Compilation
> 	A program shall not attempt to nest compilation of definitions.
> 
> The TC concluded that the implementation requirements necessary for 
> allowing nested definitions were both too complex to be worked out to 
> complete satisfaction in a reasonable time frame, and too limiting on 
> compiler technology. You can certainly have a go at it if you wish, but 
> I suspect you may find that to be true still.

Nested definitions are not needed --- I don't have nested definitions in my code --- I do have quotations that access the parent's locals and HOFs that have locals of their own.

Having "a go at" nested definitions is a dead end --- this is just pursuing Julian Fondren's meaningless fantasy --- I already have working code, and I didn't have to go down this path.

It was really HumptyDumpty who figured this out --- my own contribution to his code was minor --- I required the HOF to have locals, whereas HumptyDumpty required the HOF to not have locals.

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


#49024

From"WJ" <w_a_x_man@yahoo.com>
Date2016-07-11 01:09 +0000
Message-ID<nlurkd$q5m$1@dont-email.me>
In reply to#48998
hughaguilar96@gmail.com wrote:

> On Saturday, July 9, 2016 at 9:59:23 PM UTC-7, Julian Fondren wrote:
> > On Saturday, July 9, 2016 at 2:58:27 PM UTC-5, Håkan Thörngren wrote:
> > > 
> > > Why do we need to invent new syntax (words) for this?
> > > 
> > > Would it not be possible to just use the already existing :NONAME
> > > inside a definition?
> > > 
> > 
> > :noname is already usable inside a definition.  Where it has a
> > different meaning.  So we can't use it again for this.  It would have
> > to look something like
> > 

> >   : foo ( -- )
> >     0 IF [ :noname ." a" ; ] THEN LITERAL ;
> > 
> > 
> > -- Julian
> 
> You don't test your code, do you Julien?
> 
> Don't worry! So long as you brown-nose Elizabeth Rather,
> you still get to be considered an ANS-Forth programmer
> --- ANS-Forth is a cult --- writing code that works as never
> been required or even expected, but loyalty is demanded.

In the thread "Dynamic programming in Forth", he posted this:

> Meanwhile, in Emacs Lisp,
> 
>   (let* ((list1 (list 'a 'b 'c))
>          (list2 (cons 3 list))

That generates this error:

"Symbol's value as variable is void: list"

>          (list3 (cons 'letters list)))
>     (setf (third list3) 'z)

That is wrong also, because there is no such function
as "third" in GNU Emacs Lisp.

>     list2)
> 
> this returns (3 a z c)

It actually returns nothing, because it simply won't run.

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


#49025

FromPaul Rubin <no.email@nospam.invalid>
Date2016-07-10 18:18 -0700
Message-ID<87y459dlbq.fsf@jester.gateway.pace.com>
In reply to#49024
"WJ" <w_a_x_man@yahoo.com> writes:
>> Meanwhile, in Emacs Lisp,
>> 
>>   (let* ((list1 (list 'a 'b 'c))
>>          (list2 (cons 3 list))
> That generates this error:
> "Symbol's value as variable is void: list"

obviously was supposed to say (cons 3 list1).

>>     (setf (third list3) 'z)
> That is wrong also, because there is no such function
> as "third" in GNU Emacs Lisp.

    (require 'cl)
    cl
    (describe-function 'third)
    #("third is an alias for `cl-caddr'. ...)

works for me.

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


#49032

Fromhughaguilar96@gmail.com
Date2016-07-11 01:35 -0700
Message-ID<d08c2080-70ae-45a6-83af-9ef3ac085109@googlegroups.com>
In reply to#49025
On Sunday, July 10, 2016 at 6:18:02 PM UTC-7, Paul Rubin wrote:
> "WJ" <w_a_x_man@yahoo.com> writes:
> >> Meanwhile, in Emacs Lisp,
> >> 
> >>   (let* ((list1 (list 'a 'b 'c))
> >>          (list2 (cons 3 list))
> > That generates this error:
> > "Symbol's value as variable is void: list"
> 
> obviously was supposed to say (cons 3 list1).
> 
> >>     (setf (third list3) 'z)
> > That is wrong also, because there is no such function
> > as "third" in GNU Emacs Lisp.
> 
>     (require 'cl)
>     cl
>     (describe-function 'third)
>     #("third is an alias for `cl-caddr'. ...)
> 
> works for me.

I ignore WJ because he is a troll (works for me!) --- he only posts non-Forth code on comp.lang.forth in an attempt to show us up, and he typically has taglines that reference rape of women and children --- I don't want him to support me because I don't want to be associated with him.

WJ used to post oForth code but Franck asked him to stop. He used to post Gauche Scheme code but he stopped, presumably because the Gauche Scheme developers asked him to stop. Nobody wants WJ to support them.

Defending Julian Fondren makes you look foolish because Julian Fondren is a clown --- see his previous post: 
"It doesn't work, therefore, maybe, it's not intended to work, but just to show what :NONAME-as-[: would have to look like?  That makes more sense..."

Unlike Julian Fondren the brown-noser, I post Forth code that works --- see my last post in which I provided VFX and SwiftForth code that allows quotations to access the parent's locals and allows the HOF to have locals of its own --- this is a joke to make the Forth-200x crowd look foolish, as the "Committee of Can't" requires them believe that what I do easily is actually impossible.

When I say that it is a "joke" I mean that the crippleware RfD is pre-approved by Leon Wagner and is guaranteed to be accepted (it will become a CfV and all of the Forth-200x committee members, most of whom never participated in the discussion, will unanimously vote to approve it) --- meanwhile I have quotations that work reasonably well (the LFT method) running on VFX and SwiftForth, which the committee members (including Stephen Pelc and Leon Wagner) say is impossible.

Anybody who writes Forth code that works makes the "Committee of Can't" look foolish --- truly, they make themselves look foolish by focusing entirely on declaring what can't be done --- even on the rare occasions when they are right that something can't be done, they still look foolish because they are either oblivious to or opposed to what can be done.

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


#49026

FromJulian Fondren <julian.fondren@gmail.com>
Date2016-07-10 18:18 -0700
Message-ID<d0514ab6-438b-4adc-b668-496a3ac61091@googlegroups.com>
In reply to#49024
(cons 3 list1)

(require 'cl)   ; pleb

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


#49031

From"WJ" <w_a_x_man@yahoo.com>
Date2016-07-11 08:24 +0000
Message-ID<nlvl3e$p6i$1@dont-email.me>
In reply to#49024
WJ wrote:

> hughaguilar96@gmail.com wrote:
> 
> > On Saturday, July 9, 2016 at 9:59:23 PM UTC-7, Julian Fondren wrote:
> > > On Saturday, July 9, 2016 at 2:58:27 PM UTC-5, Håkan Thörngren wrote:
> > > > 
> > > > Why do we need to invent new syntax (words) for this?
> > > > 
> > > > Would it not be possible to just use the already existing :NONAME
> > > > inside a definition?
> > > > 
> > > 
> > > :noname is already usable inside a definition.  Where it has a
> > > different meaning.  So we can't use it again for this.  It would have
> > > to look something like
> > > 
> 
> > >   : foo ( -- )
> > >     0 IF [ :noname ." a" ; ] THEN LITERAL ;
> > > 
> > > 
> > > -- Julian
> > 
> > You don't test your code, do you Julien?
> > 
> > Don't worry! So long as you brown-nose Elizabeth Rather,
> > you still get to be considered an ANS-Forth programmer
> > --- ANS-Forth is a cult --- writing code that works as never
> > been required or even expected, but loyalty is demanded.
> 
> In the thread "Dynamic programming in Forth", he posted this:
> 
> > Meanwhile, in Emacs Lisp,
> > 
> >   (let* ((list1 (list 'a 'b 'c))
> >          (list2 (cons 3 list))
> 
> That generates this error:
> 
> "Symbol's value as variable is void: list"
> 
> >          (list3 (cons 'letters list)))


"Symbol's value as variable is void: list"


> >     (setf (third list3) 'z)
> 
> That is wrong also, because there is no such function
> as "third" in GNU Emacs Lisp.
> 
> >     list2)
> > 
> > this returns (3 a z c)
> 
> It actually returns nothing, because it simply won't run.

Here is code that actually works.
(Tested under the Lisp in GNU Emacs 23.4.1.)

(let* ((list1 '(a b c))
       (list2 (cons 3 list1))         ;; "list" changed to "list1"
       (list3 (cons 'letters list2))) ;; "list" changed to "list2"
  (setcar (nthcdr 3 list3) 'z)
  list2)

  ===>
(3 a z c)

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


#48999

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2016-07-10 06:53 +0000
Message-ID<2016Jul10.085311@mips.complang.tuwien.ac.at>
In reply to#48997
Julian Fondren <julian.fondren@gmail.com> writes:
>On Saturday, July 9, 2016 at 2:58:27 PM UTC-5, H=C3=A5kan Th=C3=B6rngren wr=
>ote:
>>=20
>> Why do we need to invent new syntax (words) for this?
>>=20
>> Would it not be possible to just use the already existing :NONAME
>> inside a definition?
>>=20
>
>:noname is already usable inside a definition.  Where it has a
>different meaning.

In particular, it means to create a new anonymous definition when the definition containing the :NONAME *runs*.  E.g.:

: curry+ ( n1 -- xt ) ( xt execution: n2 -- n )
 >r :noname r> postpone literal postpone + postpone ; ;

5 curry+ alias 5+
3 curry+ alias 3+

With closures, an alternative way to write CURRY+ would be

: curry+ {: n1 -- xt :}
  [: n1 + ;] ;

A classic Forth way of doing something similar is:

: curry+ ( n1 "name" -- )
  create ,
does> ( n2 -- n3 )
  @ + ;

5 curry+ 5+
3 curry+ 3+

- 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 2016: http://www.euroforth.org/ef16/

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


#49003

FromHåkan Thörngren <hth313@gmail.com>
Date2016-07-10 00:53 -0700
Message-ID<7183bfc4-553f-4f06-ba2c-08cafe3a8e90@googlegroups.com>
In reply to#48999
On Sunday, July 10, 2016 at 12:03:43 AM UTC-7, Anton Ertl wrote:
> Julian Fondren  writes:
> >On Saturday, July 9, 2016 at 2:58:27 PM UTC-5, H=C3=A5kan Th=C3=B6rngren wr=
> >ote:
> In particular, it means to create a new anonymous definition when the definition containing the :NONAME *runs*.  E.g.:
> 
> : curry+ ( n1 -- xt ) ( xt execution: n2 -- n )
>  >r :noname r> postpone literal postpone + postpone ; ;
> 
> 5 curry+ alias 5+
> 3 curry+ alias 3+
> 
> With closures, an alternative way to write CURRY+ would be
> 
> : curry+ {: n1 -- xt :}
>   [: n1 + ;] ;

I see, :NONAME can be used as a building block in compilation words.

Would it then be possible to use the quotation defining words outside
a colon definition, like:

[: ." foo" :]

Which I suppose would behave the same as:

:NONAME ." foo" ;

I think that the syntax for defining an anonymous word should look the
same, no matter if its occurs inside or outside a colon definition.
Or at least, such syntax should exist.

I would at least find it hard to motivate why it should be different.

Another somewhat related issue. If I want to have a named quotation,
how should it look? Is colon unusable for the same reason?

The idea would be that you can bind incoming variables at top level,
then have helper definitions visible inside that can refer to parent
bindings. The body of parent can make use of these helper definitions
by name (and they can use each other).
When parent has been compiled, the helper definitions become nameless
words.

Håkan

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


#49015

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2016-07-10 16:57 +0000
Message-ID<2016Jul10.185755@mips.complang.tuwien.ac.at>
In reply to#49003
=?UTF-8?B?SMOla2FuIFRow7ZybmdyZW4=?= <hth313@gmail.com> writes:
>Would it then be possible to use the quotation defining words outside
>a colon definition, like:
>
>[: ." foo" :]
>
>Which I suppose would behave the same as:
>
>:NONAME ." foo" ;

The proposal does not require, but allows that standard systems
support that (in the proposal the interpretation semantics of [: are
undefined); conversely, if the proposal stays that way, standard
programs cannot not use [: interpretively, but when you are copying
and pasting a piece of code for debugging (and that would be a major
usage of that feature), that is of little concern (only what the
debugging system supports is).  For standard programs, use :NONAME...;
interpretively.

Gforth (development version) has supported it for quite a while, and
it entails quite a bit of implementation complexity (plus I remember
one bug coming out of this).  Is it worth that cost?  At least one
Gforth developer thinks so:-).

>Another somewhat related issue. If I want to have a named quotation,
>how should it look? Is colon unusable for the same reason?

Right, ":" inside a definition defines a colon definition at run-time,
like :NONAME.  If you have a name for the definition, just put it
before the other definition.  I.e.,

: foo ... ;
: bar ... ['] foo ... ; \ if you want to use the xt of FOO

>The idea would be that you can bind incoming variables at top level,
>then have helper definitions visible inside that can refer to parent
>bindings. The body of parent can make use of these helper definitions
>by name (and they can use each other).
>When parent has been compiled, the helper definitions become nameless
>words.

Access to locals of the surrounding definition is not proposed in this
proposal (see discussions about that in this thread, among other
places).

You can put helper words in a separate wordlist that is not in the
search order later.

- 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 2016: http://www.euroforth.org/ef16/

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


#49007

Fromfranck.bensusan@gmail.com
Date2016-07-10 02:26 -0700
Message-ID<847b96c6-c3b4-4a5d-8ac4-adccb02aad9b@googlegroups.com>
In reply to#48999
Le dimanche 10 juillet 2016 09:03:43 UTC+2, Anton Ertl a écrit :
> In particular, it means to create a new anonymous definition when the definition containing the :NONAME *runs*.  E.g.:
> 
> : curry+ ( n1 -- xt ) ( xt execution: n2 -- n )
>  >r :noname r> postpone literal postpone + postpone ; ;
> 
> 5 curry+ alias 5+
> 3 curry+ alias 3+
> 
> With closures, an alternative way to write CURRY+ would be
> 
> : curry+ {: n1 -- xt :}
>   [: n1 + ;] ;
> 
> A classic Forth way of doing something similar is:
> 
> : curry+ ( n1 "name" -- )
>   create ,
> does> ( n2 -- n3 )
>   @ + ;
> 
> 5 curry+ 5+
> 3 curry+ 3+
> 
> - 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 2016: http://www.euroforth.org/ef16/

Hello,

This could be generalized be defining curry itself : 

: curry ( n1 xt -- xt )
   >R >R :noname R> postpone literal R> compile, postpone ; ;

5 ' * curry alias 5*


With closures, (using Oforth) : 

: curry( x f -- q )
   #[ x f perform ] ;

5 #* curry => 5*
3 5* .
15 ok

#sq #[ swap map ] curry => collsq
[ 1, 2, 3, 4, 5 ] collsq .
[1, 4, 9, 16, 25] ok

Btw, Hakan question is interesting and the answer is not obvious when you 
read the rdf : is it allowed to create a quotation outside a definition ?
[: definition seems to not allow it.

Franck

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


#49009

FromJennyB <jennybrien@googlemail.com>
Date2016-07-10 06:49 -0700
Message-ID<b6b0af01-55da-4a50-9af8-78a6e5735f9e@googlegroups.com>
In reply to#49007
On Sunday, 10 July 2016 10:26:25 UTC+1, franck....@gmail.com  wrote:

> Hello,
> 
> This could be generalized be defining curry itself : 
> 
> : curry ( n1 xt -- xt )
>    >R >R :noname R> postpone literal R> compile, postpone ; ;
> 
> 5 ' * curry alias 5*

Ah, Curry as an anonymous CREATE... DOES>. Interesting.
 
> Btw, Hakan question is interesting and the answer is not obvious when you 
> read the rdf : is it allowed to create a quotation outside a definition ?
> [: definition seems to not allow it.
> 
Rightly so. A quotation outside a definition would be a :NONAME, and if you get rid of :NONAME how do you define Curry?

The general rule is that words which parse or otherwise change the behaviour of the following word are not IMMEDIATE, so their behaviour is passed to

 the definition in which they are compiled. 

For example:  : .ascii  CHAR . ;    
                .ascii A  62 ok

If you want the action at compile time (because the value is known then) you need a different word, which by convention is enclosed in square brackets.

     : [CHAR] CHAR LITERAL ; IMMEDIATE
     : .asciiA  [CHAR] A . ;

These words can only be used within a definition, and if they are POSTPONEd then the definition in which they are POSTPONEd may also only be used within a definition. 

They all have a common form

         [ get-literal compile-literal ]  or sometimes
         [ get-literal compile-literal compile-xt ]

         looks familiar? 

Sometimes it's tempting to combine interpreting and compiling versions in the one word, which when interpreted does  get-literal or get-literal do-xt. 

The problem with this is that you cannot now have a definition that uses the interpreting behaviour, and what you get when you tick or postpone the word is implementation-dependent. 
 

         

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


#49016

Fromhughaguilar96@gmail.com
Date2016-07-10 11:04 -0700
Message-ID<e5b53e19-f574-4152-99dd-32311327eda0@googlegroups.com>
In reply to#49009
On Sunday, July 10, 2016 at 6:50:01 AM UTC-7, JennyB wrote:
> On Sunday, 10 July 2016 10:26:25 UTC+1, franck....@gmail.com  wrote:
> 
> > Hello,
> > 
> > This could be generalized be defining curry itself : 
> > 
> > : curry ( n1 xt -- xt )
> >    >R >R :noname R> postpone literal R> compile, postpone ; ;
> > 
> > 5 ' * curry alias 5*
> 
> Ah, Curry as an anonymous CREATE... DOES>. Interesting.

Factor had curry. It was never clear to me what this would be used for. Can you explain some practical purpose for this?

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


#49017

FromJennyB <jennybrien@googlemail.com>
Date2016-07-10 12:51 -0700
Message-ID<7115ea1a-d463-4ed5-b911-27d8e40f1301@googlegroups.com>
In reply to#49016
Rather relevant to the present discussion - from http://docs.factorcode.org/content/article-compositional-examples.html


Consider printing the same message ten times:
: print-10 ( -- ) 10 [ "Hello, world." print ] times ;
if we wanted to abstract out the message into a parameter, we could keep it on the stack between iterations:
: print-10 ( message -- ) 10 [ dup print ] times drop ;
However, keeping loop-invariant values on the stack doesn't always work out nicely. For example, a word to subtract a value from each element of a sequence:
: subtract-n ( seq n -- seq' ) swap [ over - ] map nip ;
Three shuffle words are required to pass the value around. Instead, the loop-invariant value can be partially applied to a quotation using curry, yielding a new quotation that is passed to map:
: subtract-n ( seq n -- seq' ) [ - ] curry map ;
{ 10 20 30 } 5 subtract-n .
{ 5 15 25 }

You might write : subtract-n  {: n :} [ n - ] map ;

The simple Forth version of course consumes code space each time it is used, but I have used it (without knowing it was called curry) to initialise an action table with a particular class of xt without having to invent a name for each.

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


#49018

Fromfranck.bensusan@gmail.com
Date2016-07-10 13:21 -0700
Message-ID<759cad41-e5cb-4567-b1f6-4f5ec1eb9ad7@googlegroups.com>
In reply to#49017
Le dimanche 10 juillet 2016 21:51:09 UTC+2, JennyB a écrit :

> The simple Forth version of course consumes code space each time it is used, but I have used it (without knowing it was called curry) to initialise an action table with a particular class of xt without having to invent a name for each.

This is a subject where an implementation using a closure is much more 
powerfull.

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


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

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


csiph-web