On Tue, May 12, 2026 at 03:47:52PM +0200, Bernd Paysan wrote:
> The cognitive burden of adding something to MARKER, and MARKER! is like this:
> 
> :is marker, ( -- )
>   defers marker,
>   my-value @ , ;
> :is marker! ( addr1 -- addr2 )
>   defers marker!
>   @+ my-value ! ;
> 
> That's it. Maybe we can make it even easier by providing :chain <defered 
> word> 
> that does the defers as first step, too.

In general I think that MARKER is not worth the effort we put into it
(just finish the session and start it again), so I am not very
sympathetic to the idea of adding more features to MARKER.

The usage above poses the question: does :IS add info to the previous
marker that resets the redefined word to its previous action?
Consider the usage

marker a
marker b
variable my-value \ why  is it called my-VALUE?
2 my-value !
:is marker, ( -- )
  defers marker,
  my-value @ , ;
:is marker! ( addr1 -- addr2 )
  defers marker!
  @+ my-value ! ;
marker c
3 my-value !
c
b
here 10000 erase
a

When C is called, everything works as designed.

When B is called, unless :IS has an undoes action that happens first,
the MARKER! action defined above is called, fetches a value that has
not been stored, and stores into MY-VALUE which is just vanishing; it
could be worse: the uninitialized value could be stored into some
non-dead memory location.

When A is called, unless :IS has previously undone the change to
MARKER!, A will try to execute a MARKER! definition that has probably
been overwritten.

We probably can find a way to get this right, but as mentioned, I
think we have already spent more time on MARKER than it is worth.

- anton

Reply via email to