2.1.1. Macro values

The macro val statement defines a LHS symbol as the expansion of the RHS. The same value can be defined any number of times, a redefinition hides the preceding defintion until the end of the scope.
Start C++ section to tut/examples/mac122.flx[1 /1 ]
     1: include "std";
     2: macro val mx1 = 1+y;
     3: macro val mx2 = 2+y;
     4: val y = 100;
     5: print mx1; endl; // 101
     6: print mx2; endl; // 102
     7: {
     8:   macro val mx1 = 3+y; // 103
     9:   print mx1; endl;
    10:   macro val mx2 = mx2 + 10; // 112
    11: };
    12: print mx1; endl; // 101
    13: print mx2; endl; // 102
    14: 
    15: // illustration of rescanning
    16: macro val r1 = y1;
    17: macro val r2 = y2;
    18: macro val y1 = print;
    19: macro val y2 = 1;
    20: 
    21: r1 r2; // print 1
    22: endl;
    23: 
End C++ section to tut/examples/mac122.flx[1]