Deutsch   English   Français   Italiano  
<vnkvvq$2a5o$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Ruvim <ruvim.pinka@gmail.com>
Newsgroups: comp.lang.forth
Subject: Re: Back & Forth - Co-routines
Date: Sat, 1 Feb 2025 15:19:21 +0400
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <vnkvvq$2a5o$1@dont-email.me>
References: <nnd$2fb29a8e$298ef3f8@23fe4f00fa62d734>
 <49736c0ec0e34ca5d67f4e0d6e8cbe2a080e38ab@i2pn2.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 01 Feb 2025 12:19:22 +0100 (CET)
Injection-Info: dont-email.me; posting-host="d81f8e46b3fa704e1e393f19315477aa";
	logging-data="75960"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19SpbI2wgL0muKmvxjc2s84"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XTasUV4dTK7aBMOIl5Z+0Hro38Y=
In-Reply-To: <49736c0ec0e34ca5d67f4e0d6e8cbe2a080e38ab@i2pn2.org>
Content-Language: en-US
Bytes: 1950

On 2025-01-31 11:33, dxf wrote:
> 
> Not sure if previously mentioned but here's another version of LOCAL
> 
> : ;:  >r ;
> 
> : LOCAL ( x adr -- )
>    r> -rot dup @ over 2>r ! ;: 2r> ! ;
> 
> variable A  variable B  8 a !  7 b !
> 
> : divide ( a b -- )  b local  a local
>    a @  b @  /  . cr  ;
> 
> 15 3 divide  a ? b ?
> 


This approach does not work well with catch/throw. Because `throw` must 
restore the values of all "local" variables that are used in the 
definitions whose execution is being terminated. And this is difficult 
to implement.


See also 13.3.3.1, item c,
<https://forth-standard.org/standard/locals#subsubsection.13.3.3.1>

| ABORT shall release all local storage resources,
| and CATCH / THROW (if implemented) shall release
| such resources for all definitions whose execution
| is being terminated.


--
Ruvim