Error processing request
Parameters
CONTENT_LENGTH | 0 |
REQUEST_METHOD | GET |
REQUEST_URI | /revision/eval?V=11 |
QUERY_STRING | V=11 |
CONTENT_TYPE | |
DOCUMENT_URI | /revision/eval |
DOCUMENT_ROOT | /var/www/nikit/nikit/nginx/../docroot |
SCGI | 1 |
SERVER_PROTOCOL | HTTP/1.1 |
HTTPS | on |
REMOTE_ADDR | 172.70.126.175 |
REMOTE_PORT | 22564 |
SERVER_PORT | 4443 |
SERVER_NAME | wiki.tcl-lang.org |
HTTP_HOST | wiki.tcl-lang.org |
HTTP_CONNECTION | Keep-Alive |
HTTP_ACCEPT_ENCODING | gzip, br |
HTTP_X_FORWARDED_FOR | 18.219.2.149 |
HTTP_CF_RAY | 88cfae7eadae2901-ORD |
HTTP_X_FORWARDED_PROTO | https |
HTTP_CF_VISITOR | {"scheme":"https"} |
HTTP_ACCEPT | */* |
HTTP_USER_AGENT | Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected]) |
HTTP_CF_CONNECTING_IP | 18.219.2.149 |
HTTP_CDN_LOOP | cloudflare |
HTTP_CF_IPCOUNTRY | US |
Body
Error
Unknow state transition: LINE -> END
-code
1
-level
0
-errorstack
INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit eval {Here's the inside story: eval is an old, old command, that's been in [Tcl] from the beginning.
As with most things, there's a formal story (the "[Unix] man-page style" of description), and
then there's a what-it-means-to-us level of narrative that is often understandable only to
insiders. Immediately below is the standard documentation entry, followed by musings
from experts.
----
http://purl.org/tcl/home/man/tcl8.4/TclCmd/eval.htm
NAME
eval - Evaluate a Tcl script
** Synopsis **
SYNOPSIS
eval arg ?arg ...?
DESCRIPTION
Eval takes one or more arguments, which together comprise a Tcl script containing one or more commands. Eval concatenates all its arguments in the same fashion as the concat command, passes the concatenated string to the Tcl interpreter recursively, and returns the result of that evaluation (or any error generated by it). (From: [TclHelp])
----
What's really going on with eval is this, at the coding level: formally, eval is about evaluation
of scripts (although note that, in modern Tcl, it's merely an abbreviation for "[uplevel] 0 ...").
This makes one think of code-data duality, such languages as [Lisp] and [Forth],
"self-modifying programs", and related esoterica. Occasionally, eval is used in this way,
and it's very powerful and crucial to Tcl that this be possible. All the commands--[bind],
everything with -command, and so on--that receive scripts as arguments depend on this.
'''However''', most Tcl applications don't need eval directly in their own coding for this
use at all. They're solving end-user problems, not diving into [introspection]. Still, eval
is pervasive in Tcl coding for a slightly "dirty" reason: it's how we expand arguments.
... [[invoke Joe English posting, explain variadic parameters, style, ...]] ...
That's the background necessary to understand the ruminations that follow.
----
Use of the eval command is considered "evil", dangerous or bad style by some Tcl'ers (because it leads to [double substitution]), but there are situations where its feature of removing one layer of list structure (like with concat) comes in just right. If you compose widgets in Tk, first you create them, then you manage them (register at a geometry manager, e.g. ''pack''). You either have to keep track of what widgets you created, and repeat that list in the pack command, or just say
eval pack [winfo children .]
'''eval''' is often used with exec, to flatten input lists:
eval exec grep foo $filelist
because otherwise ''grep'' would receive filelist as one long filename with embedded blanks. Or, if you want to append one list's elements to another:
set thislist [concat $thislist $thatlist] ;# can also be done as
eval lappend thislist $thatlist
Another application is in building up a command in pieces (by appending to a string) and finally calling
eval $cmd
'''`eval`''' concatenates its arguments in the same fashion as
----
[[Document Donal's (controversial?) [linsert] trick for pure-list
evaluation.]]
`eval` is an old, old command that's been in [Tcl] from the beginning.
----
The arguments to [[eval]] are concatenated into a string to be interpreted, but this operation does not guarantee that the string will be a well-formed script (i.e. one conforming to the Tcl parsing rules as laid out in the Tcl manual page).
`eval` is useful when one wishes to generate a script and then interpret it.
The following script breaks because the concatenation keeps the newlines from the list's string representation, making [[eval]] interpret the second element as a new command:
`[if] 1 ...`, which may be [bytecode%|%byte-compiled], is an efficient
% set arg {a
b
c
}
a
b
c
% eval list $arg
ambiguous command name "b": bgerror binary break
When using `eval`, it is very easy to leave holes which can be exploited to
To solve this, construct the argument using list primitives like [lappend], [list], etc. DKF says: "list and eval are truly made for each other."
`eval` can often be avoided, particularly with more modern recent versions of
======none
% eval [linsert $arg 0 list]
a b c
`[linsert]` converts its list argument to a well-formed list with single
[linsert] converts its list argument to a well-formed list with single spaces separating elements, and then inserts further elements into it (if any of these elements contain newlines, they remain in the resulting string).
It's important to remember that `eval` works on '''strings''', not lists,
It's important to remember that [[eval]] works on '''strings''', not lists, and the rules for interpreting a string as a list are different than the rules for interpreting a string as a script.
** Verbose Evaluation **
----
[[Explain discussion of {expand} for argument-interpolation, ...]]
----
[Tcl syntax help]
- [Arts and crafts of Tcl-Tk programming]
- [Category Command]} regexp2} CALL {my render eval {Here's the inside story: eval is an old, old command, that's been in [Tcl] from the beginning.
As with most things, there's a formal story (the "[Unix] man-page style" of description), and
then there's a what-it-means-to-us level of narrative that is often understandable only to
insiders. Immediately below is the standard documentation entry, followed by musings
from experts.
----
http://purl.org/tcl/home/man/tcl8.4/TclCmd/eval.htm
NAME
eval - Evaluate a Tcl script
** Synopsis **
SYNOPSIS
eval arg ?arg ...?
DESCRIPTION
Eval takes one or more arguments, which together comprise a Tcl script containing one or more commands. Eval concatenates all its arguments in the same fashion as the concat command, passes the concatenated string to the Tcl interpreter recursively, and returns the result of that evaluation (or any error generated by it). (From: [TclHelp])
----
What's really going on with eval is this, at the coding level: formally, eval is about evaluation
of scripts (although note that, in modern Tcl, it's merely an abbreviation for "[uplevel] 0 ...").
This makes one think of code-data duality, such languages as [Lisp] and [Forth],
"self-modifying programs", and related esoterica. Occasionally, eval is used in this way,
and it's very powerful and crucial to Tcl that this be possible. All the commands--[bind],
everything with -command, and so on--that receive scripts as arguments depend on this.
'''However''', most Tcl applications don't need eval directly in their own coding for this
use at all. They're solving end-user problems, not diving into [introspection]. Still, eval
is pervasive in Tcl coding for a slightly "dirty" reason: it's how we expand arguments.
... [[invoke Joe English posting, explain variadic parameters, style, ...]] ...
That's the background necessary to understand the ruminations that follow.
----
Use of the eval command is considered "evil", dangerous or bad style by some Tcl'ers (because it leads to [double substitution]), but there are situations where its feature of removing one layer of list structure (like with concat) comes in just right. If you compose widgets in Tk, first you create them, then you manage them (register at a geometry manager, e.g. ''pack''). You either have to keep track of what widgets you created, and repeat that list in the pack command, or just say
eval pack [winfo children .]
'''eval''' is often used with exec, to flatten input lists:
eval exec grep foo $filelist
because otherwise ''grep'' would receive filelist as one long filename with embedded blanks. Or, if you want to append one list's elements to another:
set thislist [concat $thislist $thatlist] ;# can also be done as
eval lappend thislist $thatlist
Another application is in building up a command in pieces (by appending to a string) and finally calling
eval $cmd
'''`eval`''' concatenates its arguments in the same fashion as
----
[[Document Donal's (controversial?) [linsert] trick for pure-list
evaluation.]]
`eval` is an old, old command that's been in [Tcl] from the beginning.
----
The arguments to [[eval]] are concatenated into a string to be interpreted, but this operation does not guarantee that the string will be a well-formed script (i.e. one conforming to the Tcl parsing rules as laid out in the Tcl manual page).
`eval` is useful when one wishes to generate a script and then interpret it.
The following script breaks because the concatenation keeps the newlines from the list's string representation, making [[eval]] interpret the second element as a new command:
`[if] 1 ...`, which may be [bytecode%|%byte-compiled], is an efficient
% set arg {a
b
c
}
a
b
c
% eval list $arg
ambiguous command name "b": bgerror binary break
When using `eval`, it is very easy to leave holes which can be exploited to
To solve this, construct the argument using list primitives like [lappend], [list], etc. DKF says: "list and eval are truly made for each other."
`eval` can often be avoided, particularly with more modern recent versions of
======none
% eval [linsert $arg 0 list]
a b c
`[linsert]` converts its list argument to a well-formed list with single
[linsert] converts its list argument to a well-formed list with single spaces separating elements, and then inserts further elements into it (if any of these elements contain newlines, they remain in the resulting string).
It's important to remember that `eval` works on '''strings''', not lists,
It's important to remember that [[eval]] works on '''strings''', not lists, and the rules for interpreting a string as a list are different than the rules for interpreting a string as a script.
** Verbose Evaluation **
----
[[Explain discussion of {expand} for argument-interpolation, ...]]
----
[Tcl syntax help]
- [Arts and crafts of Tcl-Tk programming]
- [Category Command]}} CALL {my revision eval} CALL {::oo::Obj422725 process revision/eval} CALL {::oo::Obj422723 process}
-errorcode
NONE
-errorinfo
Unknow state transition: LINE -> END
while executing
"error $msg"
(class "::Wiki" method "render_wikit" line 6)
invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
(class "::Wiki" method "render" line 8)
invoked from within
"my render $name $C"
(class "::Wiki" method "revision" line 31)
invoked from within
"my revision $page"
(class "::Wiki" method "process" line 56)
invoked from within
"$server process [string trim $uri /]"
-errorline
4