Please enable JavaScript to view this site.

ESL Documentation

If a block is not guarded, ESL can transfer control from a block to an outer block without encountering an explicit leave block statement. This happens when there is a stimulus for which no response is defined in the current block, but for which a response is defined in an outer block. If the relevant response is not in the current block, ESL searches each outer block, in succession (that is, each block at an outer level of nesting), for the relevant response. If one is found, ESL transfers control to the block that contains the relevant stimulus, and executes the response; for example:

 

response to Query

    make Submenu blue

    begin MainOpts

        response to SubMenu

            make Screen1 invisible

            make Screen2 visible

            begin SubOpts

                response to MainMenu

                    make Screen2 invisible

                    make Screen1 visible

                    leave block

            end SubOpts

        response to Reset

            make Screen2 invisible

            make Screen1 visible

            make SubMenu blue

            make Reset blue

    end MainOpts

 

When the object Query is selected, the response definitions in the MainOpts block become active. If the user then selects the SubMenu object, the SubOpts block becomes active. At this point, if the Reset or SubMenu objects are selected, ESL will leave the SubOpts block and respond to the object from within the

MainOpts block.

 

In a case like this, ESL leaves the innermost blocks and all intervening blocks that are not able to respond to the stimulus. These blocks are no longer active, because control is never transferred to a block at a lower level of nesting than the current block. If there are no relevant responses in the current block or in any block at a higher level of nesting, no response is taken.

 

If two or more blocks exist at any given level of nesting, only one of them can be active at any given time; for example:

 

response to A

   begin Block1

      response to B

         ...

      response to C

         begin Block2A    # Block2A and Block2B are

            response to D # equal in the nesting

            ...           # hierarchy.  Thus, if control

            response to E # is in Block2A and key G

            ...           # (which is in Block2B) is

         end Block2A      # selected, control will not

                          # be transferred to Block2B.

      response to F       # But if B is selected (which

         begin Block2B    # is in Block1), control will

            response to G # transfer to Block1, because

            ...           # it is at a higher level of

            response to H # nesting.

            ...

         end Block2B

   end Block1

 

Remember that ESL searches for responses in the program from top to bottom, from the current block through each outer block, in succession. Thus, if two responses exist for the same object, just the first one encountered will be executed. For example, if the following two responses to Show are the only ones in the program:

 

response to Show

    make Show red

    begin

        response to Show

            make Show blue

            leave block

    end

 

Here, the first time Show is selected, the first response to Show encountered is the one which makes Show turn red, and the block is entered. Now, if Show is selected again, the first response to Show encountered makes Show turn blue, and the block is left.