note 68005 added to language.exceptions
| From: | tatarynowicz at gmail dot com | Date: | Mon, 10 Jul 2006 01:26:37 +0000 |
| Subject: | note 68005 added to language.exceptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114619@lists.php.net to get a copy of this message | ||
Carlos Konstanski: You can't directly extract previous lexical environment in non-functional
languages.
What you probably _can_ do is to create a function that dumps the current lexical environment (to an
external file or to stdout) and then use it to recreate past states.
function log_lex ($vars, $functions) {
$f = fopen('lex_env.log', 'a');
fwrite($f, serialize(array($vars, $functions, get_defined_constants(), debug_backtrace()));
fclose($f);
}
log_lex (get_defined_vars(), get_defined_functions());
Writing the parser/browser for dumps is the difficult part. Then just sprinkle the code with
log_lex() and see how the program runs.
Sure, it works better in Lisp, but Lisp isn't supported on the webservers I work with, and
making PHP more like Lisp would probably make it as popular as Lisp is.
----
Server IP: 83.64.128.68
Probable Submitter: 87.206.201.94
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.exceptions.php
Edit -- http://master.php.net/note/edit/68005
Del: integrated -- http://master.php.net/note/delete/68005/integrated
Del: useless -- http://master.php.net/note/delete/68005/useless
Del: bad code -- http://master.php.net/note/delete/68005/bad+code
Del: spam -- http://master.php.net/note/delete/68005/spam
Del: non-english -- http://master.php.net/note/delete/68005/non-english
Del: in docs -- http://master.php.net/note/delete/68005/in+docs
Del: other reasons-- http://master.php.net/note/delete/68005
Reject -- http://master.php.net/note/reject/68005
Search -- http://master.php.net/manage/user-notes.php