Ow! Now we are entering the taboo area of state-smartness… In noForth we have the word FLYER . It handles state-smartness in a uniform way. FLYER uses DIVE and both are implementation dependent FLYER is a NOOP during compile time. This is what FLYER does when STATE=0 :

  1. forth goes in compile mode and compiles until end of definition
  2. then the compiled code is executed
  3. forth leaves compile mode and forgets the compiled code

<HTML><ul></HTML> <HTML><li></HTML><HTML><p></HTML>In definitions<HTML></p></HTML>

: ." ( a n -- ) flyer ." ;

<HTML><p></HTML>This new .„ is state-smart<HTML></p></HTML><HTML></li></HTML> <HTML><li></HTML><HTML><p></HTML>Outside of definitions we need -FLY<HTML></p></HTML>

: -FLY 2r> r> 2>r >r ; immediate ( r: x y z -- z x y )

<HTML><p></HTML>Use of conditionals is possible between FLYER and -FLY<HTML></p></HTML>

8 0  flyer  do i . loop   -fly



pfw/flyer.txt · Zuletzt geändert: 2023-05-03 17:25 von uho