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


Groups > comp.lang.forth > #50180

Re: A use for quotations

From Gerry Jackson <gerry@jackson9000.fsnet.co.uk>
Newsgroups comp.lang.forth
Subject Re: A use for quotations
Date 2016-08-17 10:06 +0100
Organization A noiseless patient Spider
Message-ID <np19dr$3ko$1@dont-email.me> (permalink)
References <noqejl$k6$1@dont-email.me> <np0el8$1k5c$1@gioia.aioe.org>

Show all headers | View raw


On 17/08/2016 02:29, HAA wrote:
> Gerry Jackson wrote:
>> In the RfD for quotations it states that quotations just provide
>> syntactic sugar for code that can be written using :NONAME. This has led
>> to some opposition with statements summarised by "why bother and
>> complicate Forth with an unnecessary feature".
>
> I see :NONAME is a primitive - a low-level mechanism that can be applied
> to a variety of situations.  While name-lessness in general is a bad thing
> (hard to test,

I've used :NONAME extensively and don't think such definitions are any 
harder to test than other definitions.

> re-use etc) there can still be valid uses for :NONAME

Obviously.

>  e.g.
> : +IS ( xt <name> -- )
>    >r  :noname  r> compile,  ' >body  dup >r  @ compile,  postpone ;  r> ! ;
>

When you post cryptic code like that you really ought to provide an 
example of use - one writer many readers. Ordinarily I wouldn't have 
bothered to decode it but as you replied to me I felt obliged to.
  For the benefit of others here is an example of what it does (I think) 
- prepending an action to another.

-------------------------
Gforth 0.7.9_20160113, Copyright (C) 1995-2015 Free Software Foundation, 
Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit:
: +IS ( xt <name> -- )
    >r  :noname  r> compile,  ' >body  dup >r  @ compile,  postpone ; 
r> !  ;  ok
: creator create , does> @ execute ;  ok
:noname ." mushy peas"; creator msg  ok
: msg-start ." chips and " ;  ok
msg mushy peas ok
' msg-start +is msg  ok
msg chips and mushy peas ok
: msg-start2 cr ." Fish, " ;
   ok
' msg-start2 +is msg  ok
msg
Fish, chips and mushy peas ok
----------------------------------

> IMO quotations aren't syntactic sugar for :NONAME,

I and the RfD didn't say they were. Code written using quotations can be 
rewritten using :NONAME definitions but with (probably) reduced 
readability. I just presented an example where rewriting using :NONAME 
is possible but not sensible. The converse may or may not be true.

> they are a specific application of it.

Not necessarily, an implementation of quotations may or may not use :NONAME.

>  Whatever the ills of quotations, they don't necessarily
> apply to :NONAME which is a different beast altogether.
>

What are the "ills of quotations"? The arguments I've seen are whether 
the RfD should include access to parent locals which clearly don't apply 
to :NONAME definitions that lack a parent definition.

-- 
Gerry

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


Thread

A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-14 19:51 +0100
  Re: A use for quotations Bernd Paysan <bernd.paysan@gmx.de> - 2016-08-14 19:44 +0000
    Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-14 22:57 +0100
  Re: A use for quotations hughaguilar96@gmail.com - 2016-08-14 14:05 -0700
    Re: A use for quotations Cecil Bayona <cbayona@cbayona.com> - 2016-08-14 16:16 -0500
  Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-17 11:29 +1000
    Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-17 10:06 +0100
      Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-18 12:18 +1000
        Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-19 16:07 +0100
          Re: A use for quotations "Elizabeth D. Rather" <erather@forth.com> - 2016-08-19 09:35 -1000
            Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-19 23:03 +0100
          Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-20 13:19 +1000
            Re: A use for quotations Coos Haak <htrofhc@gmail.com> - 2016-08-20 14:55 +0200
              Re: A use for quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-20 15:38 +0000
              Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-22 14:58 +1000
                Re: A use for quotations Julian Fondren <julian.fondren@gmail.com> - 2016-08-22 04:18 -0700
                Re: A use for quotations Coos Haak <htrofhc@gmail.com> - 2016-08-22 15:13 +0200
                Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-24 22:20 +1000
                Re: A use for quotations hughaguilar96@gmail.com - 2016-08-24 09:44 -0700
                Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-25 10:09 +0100
                Re: A use for quotations "HAA" <someone@microsoft.com> - 2016-08-27 12:24 +1000
  Re: A use for quotations humptydumpty <ouatubi@gmail.com> - 2016-08-17 00:55 -0700
    Re: A use for quotations hughaguilar96@gmail.com - 2016-08-17 02:19 -0700
      Re: A use for quotations humptydumpty <ouatubi@gmail.com> - 2016-08-17 07:49 -0700
        Re: A use for quotations humptydumpty <ouatubi@gmail.com> - 2016-08-17 08:18 -0700
    Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-17 10:30 +0100
      Re: A use for quotations Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2016-08-17 10:34 +0100
        Re: A use for quotations humptydumpty <ouatubi@gmail.com> - 2016-08-17 07:43 -0700
      Re: A use for quotations anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-08-18 07:35 +0000

csiph-web