|[7 earlier articles]|
|Re: nested functions firstname.lastname@example.org (Marco van de Voort) (2006-09-06)|
|Re: nested functions email@example.com (Tommy Thorn) (2006-09-06)|
|Re: nested functions Jatin_Bhateja@mentor.com (Jatin Bhateja) (2006-09-08)|
|Re: nested functions firstname.lastname@example.org (Karsten Nyblad) (2006-09-08)|
|Re: nested functions email@example.com (Tommy Thorn) (2006-09-08)|
|Re: nested functions firstname.lastname@example.org (2006-09-08)|
|Re: nested functions email@example.com (Chris Dollin) (2006-09-08)|
|From:||Chris Dollin <firstname.lastname@example.org>|
|Date:||8 Sep 2006 12:25:10 -0400|
|Organization:||HP labs, Bristol|
|Posted-Date:||08 Sep 2006 12:25:10 EDT|
Jatin Bhateja wrote:
> According to me GCC nested functions are not same as nested functions
> in functional languages as these languages are dynamically scoped
What functional languages are you thinking of? The ones with which I
have some familarity (ML, Scheme; Haskell, Miranda) are statically
scoped. Common Lisp is statically scoped except for variables
explicitly declared otherwise, if I recall correctly. [Emacs Lisp,
again if I recall what I've been told correctly, is dynamically
> and in them the order in which locals are searched is from
> inner to outermost function in enclosing order in run time stack. This
> could be implimented by using either Displays or by following the
> static link in activations records at run time.
Those two have different effects. If you just look up the run-time
stack you'll get dynamic binding, but if you use displays/static links
you'll get static binding.
function outer( callMe: ItsType ) ...
val v = ...
function inner ... refer to v ...
... outer( if someCondition then callMe else inner )
... callMe( ... ) ...
When `outer` calls `callMe` and that's a version of `inner`
it should refer to the version of `v` associated with that
`inner` and not some more deeply-nested one (coming from the
`else` part of the conditional expression).
Chris "with one mighty lexical bound he was free" Dollin
"No-one here is exactly what he appears." G'kar, /Babylon 5/
Return to the
Search the comp.compilers archives again.