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


Groups > comp.lang.forth > #43709

Re: description of Forth-2012's `synonym`

From Marcos Cruz <use_the_contact_page@programandala.net>
Newsgroups comp.lang.forth
Subject Re: description of Forth-2012's `synonym`
Date 2015-11-24 17:29 +0000
Organization Aioe.org NNTP Server
Message-ID <n326pk$3dd$1@speranza.aioe.org> (permalink)
References <n2vu0t$pa0$1@speranza.aioe.org> <n301ri$rkf$1@dont-email.me>

Show all headers | View raw


En/Je/On 2015-11-23, Bernd Paysan <bernd.paysan@gmx.de>
escribió/skribis/wrote:

>> ----
>> : synonym  ( "newname" "oldname" -- )
>>   create immediate
>>     hide ' , reveal
>>   does>  ( -- )
>>    ( pfa ) @ ( cfa ) dup >name dup ( cfa nfa nfa )
>>    compile-only? executing? and -14 ?throw
>>    immediate? executing? or
>>    if  execute  else  compile,  then  ;
>> ----

> The more problematic part is that you are using create does> for it.  Just 
> think what will happen with ' <newname> execute.

What do you mean? I've tried synonyms of `if`, `postpone`, `literal`,
non-immediate words..., and everything seems to work fine: the synonym
has the semantics of the original.

Example:

----
  synonym later postpone

  : non-imm ;
  here
  ' later execute non-imm
  dup    @ >name id.  \ "COMPILE"
  cell+  @ >name id.  \ "NON-IMM"

  : imm ; immediate
  here
  ' later execute imm
         @ >name id.  \ "IMM"

----
  
Am I missing something?

-- 
Marcos Cruz
http://programandala.net

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


Thread

description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-23 20:47 +0000
  Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-23 22:55 +0100
    Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-23 22:20 +0000
      Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-24 05:12 +0000
    Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-11-24 17:29 +0000
      Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-25 02:46 +0100
        Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-24 22:46 -0800
          Re: description of Forth-2012's `synonym` Mark Wills <markwills1970@gmail.com> - 2015-11-25 01:39 -0800
            Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 02:37 -0800
          Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-25 13:13 +0000
            Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 09:06 -0800
              Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-25 18:33 +0000
                Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-25 23:01 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 07:15 +0000
                Re: description of Forth-2012's `synonym` Raimond Dragomir <raimond.dragomir@gmail.com> - 2015-11-26 02:30 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 13:44 +0000
            Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-25 17:27 +0000
              Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-26 07:56 +0000
                Re: description of Forth-2012's `synonym` Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-26 11:25 +0000
                Re: description of Forth-2012's `synonym` Bernd Paysan <bernd.paysan@gmx.de> - 2015-11-27 01:36 +0100
                Re: description of Forth-2012's `synonym` Albert van der Horst <albert@spenarnc.xs4all.nl> - 2015-11-27 16:57 +0000
                Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 19:18 +0000
                Re: description of Forth-2012's `synonym` Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2015-11-27 19:22 +0000
                Re: description of Forth-2012's `synonym` Mark Wills <markwills1970@gmail.com> - 2015-11-27 11:48 -0800
                Re: description of Forth-2012's `synonym` anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-11-28 11:07 +0000
                Re: description of Forth-2012's `synonym` Matthias Trute <matthias.trute@gmail.com> - 2015-11-28 12:34 -0800
      Re: description of Forth-2012's `synonym` hughaguilar96@gmail.com - 2015-11-26 18:43 -0800
        Re: description of Forth-2012's `synonym` Marcos Cruz <use_the_contact_page@programandala.net> - 2015-12-05 03:35 +0000
    Re: description of Forth-2012's `synonym` hughaguilar96@gmail.com - 2015-11-26 14:39 -0800

csiph-web