POSTPONE
IMMEDIATE ワード
解釈意味論 undefined
コンパイル意味論 ( "<spaces>name" -- )
後続する空白文字をスキップし、空白文字をデリミタとして name を見つけ、現在の定義に name のコンパイル意味論を追加する。名前が存在しない場合、あいまいな状態になる。
根拠
code: 典型例
: ENDIF POSTPONE THEN ; IMMEDIATE
: X ... IF ... ENDIF ... ;
POSTPONE replaces most of the functionality of COMPILE and [COMPILE]. COMPILE and [COMPILE] are used for the same purpose: postpone the compilation behavior of the next word in the parse area. COMPILE was designed to be applied to non-immediate words. This burdens the programmer with needing to know which words in a system are immediate. Consquently, Forth standards have had to specify the immediacy or non-immediacy of all words coverd by the standard. This unnecessarily contrains implementors.
A second problem with COMPILE is that some programmers have come to expect and exploit a particular implementation, namely:
: COMPILE R> DUP @ , CELL+ >R ;
This implementation will not work on native code Forth systems. In a native code Forth using inline code expansion and peephole optimization, the size of the object code produced varies; this information is difficult to communiate to a "dumb" COMPILE. A "smart" (i.e., immediate) COMPILE would not have this problem, but this was forbidden in previous standards.
For these reasons, COMPILE has not been included in the standard and [COMPILE] has been moved in favor of POSTPONE. Additional discussion can be found in Hayes, J.R., "Postpone", Proceedings of the 1989 Rochester Forth Conference.
#Gforth