7.6.1.1360 EVALUATE BLOCK

Extend the semantics of 6.1.1360 EVALUATE to include: Store zero in BLK.

ContributeContributions

mcondronavatar of mcondron [105] When to set BLK to zero?Request for clarification2019-08-09 23:21:51

The description of this EVALUATE says to "extend the semantics of [the Core[ EVALUATE" to set BLK to zero...The Core EVALUATE performs a long sequence of steps, the last one of which is to restore the previous input specification...so, the Block modification to EVALUATE presumably sets BLK to 0 just after saving the previous input specification? What is the purpose of this? Presumably to help REFILL behave correctly, but then, which doesn't it already know the input source is not a block if SOURCE-ID is -1? It is kind of confusing, because there are two variables involved: SOURCE-ID and BLK. There are four states

SOURCE-ID =0 BLK=0 Input from user SOURCE-ID=0 BLK<>0 input from block SOURCE-ID=-1 BLK=0 Input from EVALUATE string SOURCE-ID=-1 BLK<>0 Illegal, it would seem, or at least I see no meaning to it.

So why set BLK to 0 if SOURCE-ID seems to necessarily override BLK anyway? Am I missing something?

AntonErtlavatar of AntonErtl

Yes, I think the system should set BLK to zero at some place between saving the old input source specification and interpreting.

The purpose is that programs that use BLK to determine that they are LOADing from a block work as intended. The Forth standard uses BLK and SOURCE-ID for this: In the old days, when we only had the user input device and blocks, BLK was sufficient; with INCLUDED and EVALUATE, we also got SOURCE-ID. Practically, I think the main use of BLK is to differentiate between a line and the whole screen (e.g., for , while for all other input sources PARSE and PARSE-NAME do not switch to the next line themselves.

The purpose of setting BLK in EVALUATE is probably to make programs that just look at BLK (in particular, pre-Forth-94 programs) behave the same whether EVALUATE is called from a LOADed screen, or from somewhere else.

Reply New Version