Lately I've been using this function in cases where I want to redefine the standard context std:
\extend== (\cx\form \cx=cx value; (@\std\form cx; def "std" std; form); form )
\flintstones=(value; std; use "flintstones.fxl") extend (\form std; flintstones; form ) \; # At this point "std" has been redefined to include the flintstones context, # exactly as if its definitions were built in. fred wilma
However, there may be cases where I want to use another module but I don't want that module to see the new definitions. In that case I could keep a handle to the original std context, by giving it a name such as cx_base.
\flintstones=(value; std; use "flintstones.fxl") extend (\form std; flintstones; def "cx_base" std; form ) \; # Now I can choose which module can see the new flintstones definitions: \A=(value; cx_base; use "A.fxl") # Cannot see flintstones \B=(value; std; use "B.fxl") # Can see flintstones
That can be particularly useful if the new definitions include some potentially dangerous functions and I don't always want them available.
I will soon include extend in the standard library.