status handle_loop(const loop &node) {
     // create an empty sequence
     seq temp_seq;
     // swap our optimized sequence for the empty one
     opt_seq.swap(temp_seq);
     // optimize the node's inner sequence
     node.seq::accept(*this);
     // swap back the old optimized sequence
     opt_seq.swap(temp_seq);
     // create a new node and add to the sequence
     opt_seq.emplace_back(new loop(node.loc(), temp_seq));
     return CONTINUE;
 }
 status visit(const loop &node) {
     if (node.size() == 1) {
         // test if the inner node matches a clear loop
         test_inner_sequence_visitor v;
         if (node.seq::accept(v) == CONTINUE) {
             // replace loop, just set cell to 0
             opt_seq.emplace_back(new set(node.loc(), 0, 0));
             return CONTINUE;                
         }
     }
     // else optimize inner sequence
     return opt_seq_base_visitor::handle_loop(node);
 }