Related articles |
---|
[7 earlier articles] |
Re: nested functions marcov@stack.nl (Marco van de Voort) (2006-09-06) |
Re: nested functions tommy.thorn@gmail.com (Tommy Thorn) (2006-09-06) |
Re: nested functions Jatin_Bhateja@mentor.com (Jatin Bhateja) (2006-09-08) |
Re: nested functions 148f3wg02@sneakemail.com (Karsten Nyblad) (2006-09-08) |
Re: nested functions foobar@nowhere.void (Tommy Thorn) (2006-09-08) |
Re: nested functions torbenm@app-3.diku.dk (2006-09-08) |
Re: nested functions chris.dollin@hp.com (Chris Dollin) (2006-09-08) |
From: | Chris Dollin <chris.dollin@hp.com> |
Newsgroups: | comp.compilers |
Date: | 8 Sep 2006 12:25:10 -0400 |
Organization: | HP labs, Bristol |
References: | 06-08-140 06-09-010 |
Keywords: | functional, design |
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
> languages
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
scoped.]
> 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.
[Sketch example:
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
comp.compilers page.
Search the
comp.compilers archives again.