Is it because bar is defined after foo?
Yes.
It has deleterious consequences. One solution is to add a forward declaration, which is the kind of busywork a language is supposed to eliminate.
Another is to reverse the natural order of functions, with the implementation functions at the top and the interface of the module at the bottom.
After all, do you read a website from top to bottom or bottom to top?
Yes.
It has deleterious consequences. One solution is to add a forward declaration, which is the kind of busywork a language is supposed to eliminate.
Another is to reverse the natural order of functions, with the implementation functions at the top and the interface of the module at the bottom.
After all, do you read a website from top to bottom or bottom to top?