I like how this separates declaration (semantic/2) and running semantic on the function body. Maybe this is also a candidate for "deferred" semantic3.