another rewrite of compile_decl

trying to make something about which it's easy to prove something