Deutsch   English   Français   Italiano  
<v9cs3g$38jvi$1@dont-email.me>

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

Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Gerry Jackson <do-not-use@swldwa.uk>
Newsgroups: comp.lang.forth
Subject: Re: portable or not? Volatile strings
Date: Mon, 12 Aug 2024 12:36:18 +0100
Organization: A noiseless patient Spider
Lines: 83
Message-ID: <v9cs3g$38jvi$1@dont-email.me>
References: <nnd$3d18fe02$76aace5d@9eae9618ab09b239>
 <v9cfp9$364en$1@dont-email.me> <nnd$05375ad3$6e018fac@ef3f66902c87c893>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 12 Aug 2024 13:36:16 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="e7fc423decdf2fcbfcd6bc85c0c5d209";
	logging-data="3428338"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+wcR4l9UgmnRtrjBzS8M84RK0w5xBmFzQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cU0VNx6PFmHul35a1vemQRsukxw=
Content-Language: en-GB
In-Reply-To: <nnd$05375ad3$6e018fac@ef3f66902c87c893>
Bytes: 4336

On 12/08/2024 10:01, albert@spenarnc.xs4all.nl wrote:
> In article <v9cfp9$364en$1@dont-email.me>,
> Ruvim  <ruvim.pinka@gmail.com> wrote:
is way?
>>
>>
>> Strings that are stored relatively to the HERE address may become
>> invalid after:
>>      - a definition is created via a defining word;
>>      - definitions are compiled with : or :NONAME;
>>      - data space is allocated using ALLOT, `,` (comma),
>>        `C,` (c-comma), or ALIGN.
>> — as "3.3.3.6 Other transient regions"
> 
> Not relevant. My "transient" region is permanent. That I have
> permission to invalidate doesn't affect me.
> 
>> <https://forth-standard.org/standard/usage#usage:transient> says.
>>
>> All affected transition regions shall be listed. If a region is not
>> listed as affected, than it is not affected by allocating data space memory.
> 
> My regions are not affected. So again this is not relevant.
> 
>>
>>
>> The section "11.3.4 Other transient regions"
>> <https://forth-standard.org/standard/file#file:buffers> says:
>>
>> | The system provides transient buffers for S" and S\" strings.
>> | These buffers shall be no less than 80 characters in length,
>> | and there shall be at least two buffers. The system should be
>> | able to store two strings defined by sequential use of
>> | S" or S\". RAM-limited systems may have environmental
>> | restrictions on the number of buffers and their lifetimes.
> 
> A permanent buffer can count as transient.
> 
>>
>>
>> Since this doesn't say that the buffer my become invalid after some
>> memory allocation, the buffer shall not become invalid after any memory
>> allocation (by default).
> 
> That is putting restriction to my buffer.
> 
>>
>> In the same time, a Forth system is allowed to limit the buffer lifetime
>> (for example, till the next memory allocation), and document it as an
>> environmental restriction.
> 
> Lots of talk of whether the buffers become invalid.
> My buffers never become invalid. That is not the point.
> The standard talks about transient region. My regions are permanent
> and there are other ways to handle S" , say by using ALLOCATE.
> To call a region transient and then restrict how transient they are,
> make a region not really temporary. So in this respect I am in the clear.
> Note that as S" is in a definition, the string is bound to be permanent.
> 
> So I think the program is not portable, because what I do is perfectly
> legal.
> I can't make out what you think.
> 
>>>
>>> [ It was sufficient to replace S" with S"' in order to make it run:
>>> : S"' &" PARSE ;
>>> ]
> 
> Okay let's say it out loud. Classic Forth is not fit for handling strings.
> A denotation that generates a constant string "blablabla" that has
> a status as a number is long overdue.
> The mindset of formulating standards is so 70's.
> 

Yes, transient regions are another Forth anachronism from the early days 
of Forth when memory was scarce and expensive. In my system all 
transient regions are permanent so I don't worry about them getting 
corrupted. The standard ought to be updated to make them permanent or 
make provision for the user to allot or allocate them.

-- 
Gerry