lotus



previous page: L13) What about futures in BETA?
  
page up: BETA Programming Language FAQ
  
next page: L15) How do I implement a copy (or clone) operation?

L14) Why can variables declared in execution blocks not be accessed in INNER?




Description

This article is from the FAQ, by with numerous contributions by others.

L14) Why can variables declared in execution blocks not be accessed in INNER?

Consider the following code fragment:

   P: (# do ...; (# x: ... do inner P #); ... #)
   PP: P(# do ... #)

According to the BETA visibility rules, x may not be referenced from the
do-part of PP. Why?

The answer lies in the fact that patterns may have more than one inner
section. Consider the following (slightly modified) example, where inners
are placed in different inserted descriptors, each containing declarations
of different sets of local variables:

   P: (#
      do ...;
         (# x: ... do inner P #);
         ...;
         (# y: ... do inner P #);
          ...;
      #)
   PP: P(# do ... #)

In this case, the do-part of PP is executed twice via inner, but with
different sets of local variables (x and y, respectively). It is therefore
meaningless to refer to any one of these in the do-part of PP.

 

Continue to:















TOP
previous page: L13) What about futures in BETA?
  
page up: BETA Programming Language FAQ
  
next page: L15) How do I implement a copy (or clone) operation?