Liste des Groupes | Revenir à cl forth |
Ruvim <ruvim.pinka@gmail.com> writes:On 2024-07-31 21:33, Anton Ertl wrote:That's up to those to work out who would benefit from such aMaybe those who like this kind of>
TO implementation will make a proposal that means that you cannot
POSTPONE TO with a user-defined POSTPONE.
How?
restriction.
The alternative (which may require less work) is toIt is better to implement "to" as a parsing word.
implement TO in a way that makes such a restriction unnecessary (i.e.,
such that POSTPONE TO works even with a user-defined and maybe also
the system-defined POSTPONE).
Then, can we conclude, that "to" *shall* be implemented as a parsing word?Disallow obtaining the name token for "to"? That's a very weakThat appears to be overly blunt to me and would be unlikely to gain my
approach.
support.
It seems, it is possible to test whether "to" is parsing, and if not,This is clever. Given that your test uses only Forth-94 features,
redefine it to provide a parsing "to" in a standard system.
>
I came up with the following test:
>
0 value _v1 immediate
0 value _v2
>
: test(to)
1 1
[ 1 ] to _v1 _v2 [ ( 1 | 1 0 ) ?dup 2drop ]
( 1 | 1 0 ) ?dup 2drop
;
test(to) _v2 [if]
.( ["to" is not a parsing word] )
[else]
.( ["to" is a parsing word] )
[then]
already Forth-94 can see the difference between parsing and
non-parsing TO.
*** (2)Suddenly, compilation of "test(to)" failed in VfxForth, versionI see nothing here that makes TEST(TO) non-standard. One can condense
VFX Forth 64 5.43 [build 0199] 2023-11-09 for Linux x64
>
So, either this "test(to)" or VfxForth is not standard compliant.
the case where VFX fails into:
0 value _v1 immediate
: test-to 1 to _v1 ;
VFX Forth 64 5.43 [build 0199] reacts with:
Err# -4 ERR: Data stack underflow.
-> : test-to 1 to _v1 ;
^
Let's see how your test works for the original flag-setting TO
(without optimizations):
variable to-state false to-state !--
: to true to-state ! ;
: value
create ,
does>
to-state @ if
! false to-state !
else
@
then ;
Your test indeed outputs "["to" is not a parsing word]".
Les messages affichés proviennent d'usenet.