[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Return a set-get code block for a given memory variable

     MEMVARBLOCK(<cMemvarName>) --> bMemvarBlock


     <cMemvarName> is the name of the variable referred to by the set-get
     block, specified as a character string.


     MEMVARBLOCK() returns a code block that when evaluated sets (assigns) or
     gets (retrieves) the value of the given memory variable.  If
     <cMemvarName> does not exist, MEMVARBLOCK() returns NIL.


     The code block created by MEMVARBLOCK() has two operations depending on
     whether an argument is passed to the code block when it is evaluated.
     If evaluated with an argument, it assigns the value of the argument to
     <cMemvarName>.  If evaluated without an argument, the code block
     retrieves the value of <cMemvarName>.


     .  MEMVARBLOCK() creates set-get blocks only for variables whose
        names are known at runtime.  MEMVARBLOCK(), therefore, cannot be used
        to create set-get blocks for local or static variables.  The same
        restriction applies to creating blocks using the macro operator (&).


     .  This example compares MEMVARBLOCK() to a code block created
        using the macro operator (&).  Note that using MEMVARBLOCK() allows
        you to avoid the speed and size overhead of the macro operator:

        PRIVATE var := "This is a string"
        // Set-Get block defined using macro operator
        bSetGet := &( "{ |setVal|;
              IF( setVal == NIL, var, var := setVal ) }" )
        // Set-Get block defined using MEMVARBLOCK()

        // bSetGet created here is the functional
        // equivalent of bSetGet above
        bSetGet := MEMVARBLOCK("var")

 Files   Library is CLIPPER.LIB.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson