test1 = function :: int; entry { appendA() + appendB } appendA = function:: int { append("a", "/tmp/test1.txt") } appendB = function:: int { append("b", "/tmp/test1.txt") } append:: function(message::string, filename::string):: int, { f = initialize(filename):: FILE. fprintf(f, message) } ====================================================== initialize(filename:: string; exploitation_file_initialized) { // get cached descriptor for FileName: files:: cached(exploitation_files). files[filename] } attach scope:: openFile(FileName) { fid = fopen(FileName). (FileName, fid):: cached(exploitation_files). } attach scope:: closeFile(FileName){ files:: cached(exploitation_files). fid = files[FileName]. fclose(fid) }