Re: Nested routines

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jason Gade wrote:
> 
> What is the utility of nested routines? What problems do they solve that can't
> be solved by refactoring and simplification?
> 
> --
> A complex system that works is invariably found to have evolved from a simple
> system that works.
> --John Gall's 15th law of Systemantics.
> 
> "Premature optimization is the root of all evil in programming."
> --C.A.R. Hoare
> 
> j.

Sharing of private data and simple splitting of otherwise large routines.
Instead of passing arguments (whih has a cost) between 3,4, 5 routines, use
variables common to all the involved routines, and hide these symbols even from
the rest of the file.
This also makes code more maintainable, as the scope of more variables is being
restricted in a visible way.
Perforance call: call_func/call_proc have to check that a dynamic call o a
nested routine is valid. Not much, and not often at all. It's not even a loss, as
non nested routine calls are not affected (apart from a "if (symtab[s].u->parent
!= toplevel) test in backend.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu