4. Scope

Unlike C++, the scope of an identifier is the whole of the construction containing it, just like labels. In particular, all functions in the same scope are mutually recursive: a function can be called before it is defined without a forward declaration.
Start C++ section to tut/examples/mig03.flx[1 /1 ]
     1: include "std";
     2: fun f(x:int) => g(x-1);
     3: fun g(x:int) => if x>0 then f(x-1) else 0 endif;
     4: print (g 10); endl;
     5: 
End C++ section to tut/examples/mig03.flx[1]
In particular this rule also applies to types, allowing recursive types to be easily defined:
Start C++ section to tut/examples/mig04.flx[1 /1 ]
     1: include "std";
     2: union ilist = empty | cons of int * ilist;
     3: var x = empty;
     4: x = cons (1,x);
     5: x = cons (2,x);
     6: 
     7: proc print(x:ilist) {
     8:   match x with
     9:   | empty => {}
    10:   | cons (?h,?t) => { print h; print " "; print t; }
    11:   endmatch;
    12: }
    13: 
    14: print x; endl;
End C++ section to tut/examples/mig04.flx[1]