6.1.0580 >R to-r CORE

Interpretation:

Interpretation semantics for this word are undefined.

Execution:

( x -- ) ( R: -- x )

Move x to the return stack.

See:

Testing:

T{ : GR1 >R R> ; -> }T
T{ : GR2 >R R@ R> DROP ; -> }T
T{ 123 GR1 -> 123 }T
T{ 123 GR2 -> 123 }T
T{  1S GR1 ->  1S }T      ( Return stack holds cells )

ContributeContributions

finnwavatar of finnw [450] Using a separate stack for `>R`, `R>`, `R@` and friendsRequest for clarification2026-10-26 20:48:56

Does a system actually need to place these values on the return stack? Could it use a separate, dedicated stack for this?

Or to put it another way, is there any way for a standard program to detect that this is happening?

AntonErtlavatar of AntonErtl

If your question is if >R R> R@ have to use the same stack as nest-sys (what calls push and what EXIT pops from some stack) or other system-execution types (see , the answer is no; system-execution types may be on the same stack, they may be elsewhere, or partially here or there, or they can even have a size of 0 cells (e.g., when inlining). So in this sense the topic in the title can be answered: "Yes, you can use a separate stack for >R and friends".

The standard calls the stack used by >R etc. the return stack. So in this sense the answer to "Does a system actually need to place these values on the return stack?" is yes, and consequently, the answer to "Could it use a separate, dedicated stack for this?" is no. But system-execution types can use one or more separate, dedicated stacks for this, which has the same effect, as far as programs and system implementations are concerned.

AFAICS a standard program has no way of determining how many cells on the return stack (if any) a system execution type uses. This should answer your last question.

This posting should answer your questions, so I am closing this RfC. If there is anything still unclear, please reopen it.

Closed
Reply New Version