Re: Nested routines

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

Jeremy Cowgar wrote:
> 
> Jason Gade wrote:
> > 
> > What is the utility of nested routines? What problems do they solve that
> > can't
> > be solved by refactoring and simplification?
> > 
> 
> Have you ever had to repeat a task over and over in a function that takes
> multiple
> local paramters and is only used within that one function?

Not that I can recall. I'd probably just make a separate function.

> Why make a top-level
> function putting it at least into the file scope, deal with passing all the
> parameters to the function and getting the result when one could create a
> nested
> routine?

Again, I don't see the utility of nesting it vice putting it at the file scope.
If your file is so large that putting the function in file scope would cause a
name clash then maybe your file needs to be split up better.

> 
> Take a peek at: <a
> href="http://en.wikipedia.org/wiki/Nested_function">http://en.wikipedia.org/wiki/Nested_function</a>
> for a little
> more info.
> 
> --
> Jeremy Cowgar
> <a href="http://jeremy.cowgar.com">http://jeremy.cowgar.com</a>

Right, I know what they are even though I've never used them. I just don't see
any use for them.

--
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.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu