Deutsch   English   Français   Italiano  
<v8dntr$1lcff$1@dont-email.me>

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

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Ruvim <ruvim.pinka@gmail.com>
Newsgroups: comp.lang.forth
Subject: VALUE and TO implementation (was: Operator overloading?)
Date: Wed, 31 Jul 2024 20:14:51 +0400
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <v8dntr$1lcff$1@dont-email.me>
References: <a1aab44ee3b1b56c2f54f2606e98d040@www.novabbs.com>
 <v8b04c$137lg$1@dont-email.me> <nnd$6e668a8e$712b1a09@1b1e479e823969fb>
 <v8cuur$1go8k$1@dont-email.me>
 <2af79ef5abcec71a1d42a461b6bc56b8@www.novabbs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 31 Jul 2024 18:14:51 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="b3021b45cca975a84d9e54d6307d6ce1";
	logging-data="1749487"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+ypu9KOtGaNvLixms0hx/0"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:NU1+N7CXPfn6682yOS+ik1rt7Z4=
In-Reply-To: <2af79ef5abcec71a1d42a461b6bc56b8@www.novabbs.com>
Content-Language: en-US
Bytes: 2773

On 2024-07-31 13:41, mhx wrote:
> On Wed, 31 Jul 2024 9:08:43 +0000, Gerry Jackson wrote:
> [..]
>> 111 value x x . 111  ok
>> 222 to cr .( Does TO parse? ) x x 222 = [if] .( No it doesn't!) [then]
>> Does TO parse? No it doesn't! ok
> [..]
> 
> As does iForth.
> 
>> You could argue that it's not a standard program because it contains a
>> deliberate ambiguous condition so a parsing TO would fail in some way
>> but it does demonstrate non-compliant behaviour.
> 
>   222 TO cr
> 
> should (I hope!) produce an exception (unless CR is redefined),
> so this *definitely* fails and doesn't even finish the test.
> 
> I'm not sure that you can use a buggy program to test for an ambiguous
> condition (looks like a top job for an eager lawyer). It would be
> much better if the anomaly can be shown with a valid program.

When we want to apply a parsing word to a calculated string, we can use 
"execute-parsing" (that can be defined in a standard way [1]). For a not 
parsing "to", this standard-compliant method will fail.


A testcase:

   : apply-compiling(to) ( sd.name -- )
     [: postpone to ;] execute-parsing
   ;

   t{ 0 value x -> }t
   t{ : t1 1 [ s" x" apply-compiling(to) ] ; -> }t
   t{ x t1 x -> 0 1 }t



NB: "postpone" can be defined in a standard way via "find-name" so that 
is apples to "to" [2].

[1] <https://theforth.net/package/compat/current-view/execute-parsing.fs>
[2] 
<https://github.com/ForthHub/discussion/discussions/103#user-content-solution>


--
Ruvim