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


Groups > comp.lang.forth > #37318

Re: local variable

From "Rod Pemberton" <buzz@notnotnontnooatno.cmm>
Newsgroups comp.lang.forth
Subject Re: local variable
Date 2015-03-16 19:00 -0400
Organization Aioe.org NNTP Server
Message-ID <op.xvl4ufptv6dtjm@localhost> (permalink)
References <5504c7af$0$2974$426a74cc@news.free.fr> <2015Mar16.163600@mips.complang.tuwien.ac.at> <caa6849b-b85c-49b7-b06e-950a3b55e8d6@googlegroups.com> <me7e4v$ed9$1@dont-email.me>

Show all headers | View raw


On Mon, 16 Mar 2015 16:24:46 -0400, Alex McDonald <blog@rivadpm.com> wrote:
> on 16/03/2015 17:09:36,  wrote:
>> On Monday, March 16, 2015 at 8:37:48 AM UTC-7, Anton Ertl wrote:

>>> grobibi <tristanhennequin@free.fr> writes:
>>> >Is there a way to bypass this because, for me, a local variable has to
>>> >behave like in lisp like this : (defun foo (x) (let ((lst)) ) ... It
>>> >will initialize lst to nil (but it can be initialized to anything.).
>>>
>>> In Gforth:
>>>
>>> : foo { x -- ? }
>>>   0 { lst } ... ;
>>
>> Your code fails under VFX:
>>
>> : foo { x -- ? } 0 { 1st } x . 1st . ;
>> Err# -421 Multiple local definitions in one word
>> -> : foo { x -- ? } 0 { 1st } x . 1st . ;
>>
>> It should fail, because this is a violation of ANS-Forth. See the
>> infamous section 13.3.3:
>>
>> Immediate words in a program may use (LOCAL) to implement syntaxes for
>> local declarations with the following restrictions: - A program shall
>> not compile any executable code into the current definition between
>> the time (LOCAL) is executed to identify the first local for that
>> definition and the time of sending the single required "last local"
>> message;
>>
>
> It doesn't fail because of that section; you're misreading, and Anton
> specifically said "In Gforth". It fails on
>
> 13.6.2.2550 ...
> The following ambiguous conditions exist when:
> ..
> – {: . . . :} is used more than once in a word.
>
> This works in both Gforth and VFX.
>
> : foo ( x -- ? ) 0 { x lst } ... ;
>
> Replace { } with {: :} for modern notation.

Well, I'm definately not up to date on locals, but I think
you posted something very different from what Anton posted.

You unconsciously fixed Anton's typing mistake, but Hugh didn't.
You changed the first set of curly braces to parenthesis, but
Hugh accepted them as-is, as what Anton meant.  So, Anton posted
two sets of locals.  It seems clear the first set is a typing
mistake and should actually be a set of parameters using
parenthesis.  I.e., just how do you use two dashes and a
quotation mark as locals?  ...  Well, Hugh showed how, and
showed that it doesn't work.

So, it seems that it was you who misread, yet again ...

Of course, we'll probably never get a correction from
Anton, as is normal when he makes a mistake.


Rod Pemberton

-- 
Cars kill more people than guns in the U.S.
Yet, no one is trying to take away your car.

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


Thread

local variable grobibi <tristanhennequin@free.fr> - 2015-03-15 00:43 +0100
  Re: local variable "Elizabeth D. Rather" <erather@forth.com> - 2015-03-14 15:01 -1000
    Re: local variable grobibi <tristanhennequin@free.fr> - 2015-03-15 02:50 +0100
    Re: local variable albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-15 03:02 +0000
  Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-15 02:53 +0100
    Re: local variable "WJ" <w_a_x_man@yahoo.com> - 2015-03-17 22:29 +0000
  Re: local variable hughaguilar96@gmail.com - 2015-03-14 20:45 -0700
    Re: local variable stephen@mpeforth.com (Stephen Pelc) - 2015-03-15 10:53 +0000
      Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-15 22:54 +0100
      Re: local variable hughaguilar96@gmail.com - 2015-03-15 19:45 -0700
        Re: local variable hughaguilar96@gmail.com - 2015-03-15 20:15 -0700
          Re: local variable grobibi <tristanhennequin@free.fr> - 2015-03-16 08:42 +0100
        Re: local variable stephen@mpeforth.com (Stephen Pelc) - 2015-03-16 07:51 +0000
          Re: local variable hughaguilar96@gmail.com - 2015-03-16 09:59 -0700
            Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-16 20:31 +0000
            Re: local variable "WJ" <w_a_x_man@yahoo.com> - 2015-03-18 08:59 +0000
      Re: local variable "HAA" <someone@microsoft.com> - 2015-03-17 13:47 +1100
        Re: local variable stephen@mpeforth.com (Stephen Pelc) - 2015-03-17 10:59 +0000
          Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-17 18:55 +0100
            Re: local variable stephen@mpeforth.com (Stephen Pelc) - 2015-03-17 18:43 +0000
          Re: local variable "HAA" <someone@microsoft.com> - 2015-03-18 13:25 +1100
            Re: local variable "Elizabeth D. Rather" <erather@forth.com> - 2015-03-17 16:43 -1000
              Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-18 04:09 +0100
                Re: local variable "Elizabeth D. Rather" <erather@forth.com> - 2015-03-17 17:55 -1000
                Re: local variable "HAA" <someone@microsoft.com> - 2015-03-20 22:28 +1100
                Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-20 15:43 +0100
                Identifying self interest (was Re: local variable) "Alex McDonald" <blog@rivadpm.com> - 2015-03-20 15:20 +0000
            Re: local variable "WJ" <w_a_x_man@yahoo.com> - 2015-03-18 08:48 +0000
        Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-17 14:18 +0000
          Re: local variable albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-03-17 16:24 +0000
            Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-17 16:34 +0000
            Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-18 14:32 +0000
          Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-17 20:08 +0100
            Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-18 15:21 +0000
  Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-16 15:36 +0000
    Re: local variable hughaguilar96@gmail.com - 2015-03-16 10:09 -0700
      Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-16 20:24 +0000
        Re: local variable "Rod Pemberton" <buzz@notnotnontnooatno.cmm> - 2015-03-16 19:00 -0400
          Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-17 12:06 +0000
            Re: local variable stephen@mpeforth.com (Stephen Pelc) - 2015-03-17 14:37 +0000
            Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-17 18:58 +0100
          Re: local variable Doug Hoffman <glidedog@gmail.com> - 2015-03-17 08:55 -0400
          Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-17 14:15 +0000
      Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-17 16:54 +0000
        Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-17 17:45 +0000
          Re: local variable Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-17 20:14 +0100
          Re: local variable anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-03-20 15:06 +0000
            Re: local variable hughaguilar96@gmail.com - 2015-03-20 16:14 -0700
              Re: local variable "Alex McDonald" <blog@rivadpm.com> - 2015-03-21 09:47 +0000
  Re: local variable "WJ" <w_a_x_man@yahoo.com> - 2015-03-18 05:04 +0000
  Ignore the standard Stefan Mauerhofer <smauerhofer@androsoft.ch> - 2015-03-18 04:09 -0700
    Re: Ignore the standard Doug Hoffman <glidedog@gmail.com> - 2015-03-18 07:26 -0400
      Re: Ignore the standard "WJ" <w_a_x_man@yahoo.com> - 2015-03-20 17:31 +0000
        Re: Ignore the standard Doug Hoffman <glidedog@gmail.com> - 2015-03-20 17:41 -0400
          Re: Ignore the standard "Elizabeth D. Rather" <erather@forth.com> - 2015-03-20 14:26 -1000
            Re: Ignore the standard Doug Hoffman <glidedog@gmail.com> - 2015-03-21 06:00 -0400
              Re: Ignore the standard hughaguilar96@gmail.com - 2015-03-21 15:11 -0700
          Re: Ignore the standard Bernd Paysan <bernd.paysan@gmx.de> - 2015-03-21 02:49 +0100
            Re: Ignore the standard Doug Hoffman <glidedog@gmail.com> - 2015-03-21 06:04 -0400
    Re: Ignore the standard "Alex McDonald" <blog@rivadpm.com> - 2015-03-18 16:05 +0000
    Re: Ignore the standard "WJ" <w_a_x_man@yahoo.com> - 2015-03-20 17:13 +0000

csiph-web