Talk:Funarg problem

message: I don't understand the difference between upwards and downwards funarg 202.163.215.11 06:41, 16 June 2006 (UTC)
thread_title:  Upwards vs. downwards funarg? 

message: This article is a little incorrect. C can have nested functions and they are available in GCC's dialect. From what I have read (I have no need for nested functions :) they go out of scope when the parent function ends (just like variables) thereby solving the problem. -- 127.*.*.1 14:02, 23 August 2006 (UTC)
replies: text: It is correct. Nested functions are not in any C standard. That GCC supports them (and maybe other compilers) is only an extension specific to that compiler. 16:54, 4 April 2009 (UTC)

text: I would add, too, that if I'm reading your post correctly, that "going out of scope when the parent function ends" does not solve the problem; to the contrary, it specifically introduces the problem.Liberulo (talk) 07:07, 5 August 2011 (UTC)
thread_title:  Nested functions in C 

message: This is usually accomplished by representing function values as heap-allocated closures, as previously described.
Could that statement be backed with sources? I find it strange at first, knowing that one of the first papers of one of the first implementations of Scheme, namely "RABBIT: A Compiler for SCHEME", Steele's Master Thesis, says the following:
A fair amount of analysis is devoted to determining whether environments may be stack-allocated or must be heap- allocated.
—The preceding unsigned comment was added by Nowhere man (talk • contribs).
:RABBIT tries to optimize the implementation by using a stack when possible, and when it is observably equivalent to using the heap.  The simple way is to just allocate all closures on the heap.  It is fair to say that RABBIT "represents function values as heap-allocated closures" but uses the stack under the covers for efficiency when it is observationally equivalent. 99.105.56.46 (talk) 05:17, 2 October 2023 (UTC)
thread_title:  Typical implementation as heap-allocated closures 

message: I do not see why it should be any more complex than returning a pointer to a function.
If a ynamic language like Ocaml or Lisp can define function on the fly, all that is needed is a way to reference those functions... Obviously that is already done.
Moreover, the whole idea of Lisp was to implement lambda expressions as a computational model, therefore Funargs were invented even before Lisp was invented (even before computers were invented).
—The preceding unsigned comment was added by 201.239.221.235 (talk • contribs).
:Not quite. You're right that the funarg problem has now been solved; but it's actually much more complex than just returning a pointer to the function, and it wasn't solved until well after the initial versions of Lisp. —RuakhTALK 14:49, 14 August 2007 (UTC)
replies: text: Not quite.  This article refers to "a function's state" as if that's a given, but there is no such thing as a function state at the time a function is passed if function bodies are not allowed to refer to their defining environment.  Functions that do refer to their defining environment are known as closures.  Hence the confusion (at least on my part). Rp (talk) 08:08, 3 September 2008 (UTC)
replies: text: I have added an introductory paragraph and two references in an attempt to clarify - please review. Rp (talk) 15:48, 3 September 2008 (UTC)
thread_title: I do not understand

message: I believe that the statements made about Java in this article are no longer true as of Java 1.8. 85.171.168.113 (talk) 19:15, 11 August 2014 (UTC)
thread_title:  Java 1.8