Talk:Eval
From Wikipedia, the free encyclopedia
Does Lua have "eval-functionality"? (I just glanced at the docs: http://www.lua.org/manual/5.1/manual.html#2.4.1 : "The unit of execution of Lua is called a chunk...A chunk may be stored in a file or in a string inside the host program" ) teadrinker 23:20, 3 March 2006 (UTC)
- Yes, you can load and execute any string or file in Lua. The result is a "chunk" (or function in other words). For example:
myFunc = loadstring(aCodeString) myFunc()
- or just:
loadstring(aCodeString)() --Loading and executing string at once
- --Zigmar 19:29, 13 July 2006 (UTC)
This article was previously nominated for deletion. The deletion result was moved to here, and has been removed to: Wikipedia:Articles for deletion/Eval --AllyUnion (talk) 03:34, 30 September 2005 (UTC)
Contents |
[edit] Python section
The python section claims that python cannot evaluate statements, only functions. Then the two example show calling eval for statements.
What gives?
Dubwai 15:43, 29 December 2006 (UTC)
I missed that there's a distinction between exec and eval. Ignore.
Dubwai 16:46, 29 December 2006 (UTC)
[edit] Jonathan Johnson
The link "Jonathan Johnson on exposing classes to RBScript" looks suspiciously self-promotional to me. Before I included the link to Python documentation, it was the only external link in this article, and it mentions "Jonathan Johnson" as if he is some kind of Computer Science authority (reading his blog you do find out he works for the company that makes RealBasic). If you are reading this, and you agree that it is self-promotion, do erase the link. --Ramalho 03:46, 7 April 2007 (UTC)
[edit] Callback
Perhaps it would be better to demonstrate an example of using eval on a callback situation, since it's a legitimate use.
Azraell Zanella 01:11, 18 July 2007 (UTC)
[edit] apply yin and yang
This article doesn't quite ever mention that eval and apply are related in a yin and yang fashion: in order to (eval '(f x)) your system must make the critical step (apply f x) to get the actual result. To be clear: the code must convert the string f to a callable function f, and then must apply the callable function f to its arguments! Unfortunately, the article on apply says almost nothing about the computer-sciene meaning of this idea.linas (talk) 07:30, 23 November 2007 (UTC)