I've been building up tools for problem solving, and one that came to mind was a form of meta programming. I've found that often I'll know exactly how to structure the entire program, but there are a few loop bounds where it's not immediately clear (e.g. do we end the loop at n, or n-1, or n+1.) Rather than do this hard work of thinking/debugging, every reasonable bound choice is added as a label, and a higher level program generates program strings that are compiled with every possible combination of bounds, returning all of the program strings which pass all local test cases.
Does anyone actually do this, or similar metaprogramming trickery in practice, or is it a fools errand?