http://qs321.pair.com?node_id=11138796


in reply to Re^4: What technical benfits perl offers over python + few more questions.
in thread What technical benfits perl offers over python + few more questions.

My understanding of an iterator function tells me it's code that returns an item from a list -- which sounds like dynamic code. I don't believe C can do that easily.

C does have scoped variables, where a variable only exists within a pair of braces. When I was writing C code that got cross-compiled to 68000 assembler, I could see that the compiler just assigned space on the stack for that type of variable by moving the stack pointer down, and once the scope ended, the stack pointer was just adjusted back up.

C also has the static keyword, which says the variable is to be stored in the lexical scope, meaning it's created at the beginning of the run (perhaps on the stack, but not anywhere that's going to get re-used), and only initialized once, if that initialization happens during declaration. So my guess is that closures are possible -- but keep in mind I studied engineering and not computer science, so that opinion is just what I've picked up since I left university.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.