I use a lot nested procedures and functions, in fact, whenever I can.
For instance: I divide long bodies in small nested procedures. In OOP,
If a private method is called only by a procedure, I convert it into a
nested routine. In case statements, if the body of a label has more than
a few lines, it calls to a nested proc. If statements, if the THEN and
the ELSE have long bodies, I convert them into nested procs.
I love nested routines, I abuse of them.
1) In OOP, they save me jumping to the interface to declare things.
2) It shortens bodies, so they can fit in a screen.
2) It allows me declaring objects near to where they are used and easily
encapsulate variable names.
3) They save a little of stack.
The cons: Most tools are not very nested routines friendly. Debuggers
have problems with them, code tools are not aware of nested routines.
Many people that use other languages say "Why? what do you want it for?"
What are your feelings towards nested routines?
fpc-other maillist - firstname.lastname@example.org