[SLOF] [PATCH v5 1/2] Fix output word

Segher Boessenkool segher at kernel.crashing.org
Wed Mar 28 09:41:37 AEDT 2018


On Tue, Mar 27, 2018 at 08:48:35PM +0200, Laurent Vivier wrote:
> On 27/03/2018 19:54, Segher Boessenkool wrote:
> > On Tue, Mar 27, 2018 at 02:03:41PM +0200, Thomas Huth wrote:
> >>>> That is very problematic.  If the xt of term-io-emit already is the
> >>>> behaviour of emit, this will loop.
> >>
> >> I'm afraid to object Segher, but as far as I can see, this can not
> >> happen. The "[ ' emit behavior compile, ]" happens *while* the Forth
> >> word is compiled, and the first "' term-io-emit to emit" happens *after*
> >> the Forth word is compiled. So how should the term-io-emit XT end up in
> >> "emit" before the term-io-emit Forth word is compiled?
> > 
> > Exactly as you say for example: if it was done *before*.
> > 
> > This [ ... behavior ... ] stuff is very fragile.  It does not have
> > to be that way.
> > 
> > Why don't you set debug versions to the emit hook very early?  Why
> > won't that work?
> 
> My FORTH knowledge is not good enough to know how to do that...
> 
> Could you show me how to do that?

Just

' early-debug-emit IS emit

or similar.  If you get problems of not having defined things where you
want to first refer to them, you can always add a second hook (assign
one to the other, the same way you use with DEFER for other forward
declarations).  It is better to define things in a better order, of
course, but forward refs are handy sometimes.


Segher


More information about the SLOF mailing list