I don’t think the value of editor macros comes from their “procedural style”, but rather that you are synthesizing an algorithm from a concrete example. The declarative version is just listing input-output examples. You might start with
\subsection{Object on vertical spring} --> ** Object on vertical spring
and the computer will say, ‘did you mean replace("\subsection{", "** ")); replace("}", "")?’ You look at your document and realize that this wouldn’t give the right results later in your document where you have \{x \in S | f(x) \}, so you add another example:
\{x \in S | f(x) \} --> \{x \in S | f(x) \}
and now the computer gives you the algorithm you desire. There’s a wealth of literature on this topic, this paper in PLDI ‘15 might be a good place to start.
I don’t think the value of editor macros comes from their “procedural style”, but rather that you are synthesizing an algorithm from a concrete example. The declarative version is just listing input-output examples. You might start with
\subsection{Object on vertical spring} --> ** Object on vertical springand the computer will say, ‘did you mean
replace("\subsection{", "** ")); replace("}", "")?’ You look at your document and realize that this wouldn’t give the right results later in your document where you have\{x \in S | f(x) \}, so you add another example:\{x \in S | f(x) \} --> \{x \in S | f(x) \}and now the computer gives you the algorithm you desire. There’s a wealth of literature on this topic, this paper in PLDI ‘15 might be a good place to start.