Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not very familiar with dynamic scoping, so maybe I've misunderstood it, but that doesn't appear to be true. What variable a name binds to is determined entirely at runtime, which happens for globals too. You cannot end up accessing a variable in your caller unless they explicitly pass in a reference to it, and it's not possible to write a function which refers to a single global variable in the code, but which can refer to different variables at runtime depending on the caller.


You are correct. C is lexically (a.k.a. statically) scoped, through and through.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: