Maybe literate programming (http://en.wikipedia.org/wiki/Literate_programming) goes some way towards that? Or at least could be extended to do that?
They would write text, then a code block:
func main() {
<main body variable declarations>
<main body functions>
}
followed by another block of text, and then an expansion of the code <main body variable declarations> =
var foo int
var bar int64
And so on. <main body variable declarations> +=
var zed rune
Which, when run through the "tangler", would produce: func main () {
var foo int
var bar int64
var zed rune
}
The first really interesting implementation I've seen of literate programming, and it makes me want to implement it myself.