I personally don’t like forward referencing because it makes code harder to read. You can no longer rely on the dependency graph being in topological order.
> topological order
You are correct. But its the reverse topological order, which is not the most readable ordering. One doesn't read a newspaper article starting at the bottom.
If I am writing some kind of service, I would write the main public functions first, using undefined functions in their bodies as needed. Then I would implement those functions below.
You don't often see
Answer = A + B,
where
A = ...
...
B = ...
albeit you sometimes see it, and it is totally valid. For proofreading something, it makes a big difference: if things are in a topological order, you can simulate a constant memory finite machine. If they are not in a topological order, well, probably you better just rewrite it (or at least I do).For most other things, I usually prefer the bird-view first, when I am doing or reading some elses math.
Funnily the language Haskell which operates on definitions, is very order independent, it even allows circular definitions. I like it for leetcode and such.