Artifacts Associated With Ticket 820be4117d621f80
Ticket change [cd823a4c14] (rid 138221) by sebres on 2014-05-21 10:29:47:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I think, if by compiling a command we make possible to set a flag like TCL_SubstInside, that will be a great feature to minimize common overhead. There are many cases where we could use this feature. For example logging in middle level, something like: % log DEBUG $Cmd "execute statement: $statement, result: [res2str $res], ..." To this effect, if DEBUG level is off, the substitution is totally needless. Of course we could enclose it in braces (as below), and after verifying of level substitute in uplevel in log command: % log DEBUG {$Cmd "execute statement: $statement, result: [res2str $res], ..."} But, substitution in uplevel is not really good solution, imho, but at the moment only this solution is possible, to minimize overhead. The logik bellow is not really solution also, because is too long also and if later I will change algorithn to check log-level I should change many lines of code: % if {DEBUG ni $log::levels} {log DEBUG {$Cmd "..."}} - foundin initialized to: ">= 8.5"
- is_private initialized to: "0"
- login: "sebres"
- priority initialized to: "5 Medium"
- private_contact initialized to: "50e9528765c18296566374b3fde2df942c394efd"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "sebres"
- subsystem initialized to: "47. Bytecode Compiler"
- title initialized to:
Pre-decision of substitution of the command arguments / {substitute inside} - type initialized to: "RFE"
Ticket change [f5db3b78c9] (rid 138222) by sebres on 2014-05-21 10:31:48:
- assignee changed to: "sebres"
- login: "sebres"
- mimetype: "text/plain"
Ticket change [c53d1f289a] (rid 138227) by dkf on 2014-05-21 18:12:00:
- assignee changed to: "msofer"
- icomment:
That makes it astoundingly hard to get the semantics right. For example, suppose you did: <pre> log DEBUG $Cmd "execute statement $statement, result: [break]" </pre> In that case, the semantics of <tt>log</tt> don't matter as the <tt>break</tt> will take precedence. <p> <i>Because of this complexity, I'd be inclined to reject this RFE.</i> Leaving to Miguel to take the final decision. <hr> Other logging frameworks in languages like Java have equivalent problems, and solve them by allowing probing of the log level. We could also take the message argument and do <tt>uplevel 1 subst</tt> on it if we're going to do the logging, allowing it to be quoted with <tt>{</tt>braces<tt>}</tt>, but that also doesn't require changes to Tcl's parse/compile semantics. - login: "dkf"
- mimetype: "text/html"
- priority changed to: "3 Low"
- username: "dkf"
Ticket change [4c6f0021e0] (rid 139158) by msofer on 2014-08-06 16:58:38:
- closedate changed to: "2456876.2073941"
- closer changed to: "msofer"
- icomment:
This requires a change in the basic rules in Tcl.n, so exceeds the scope of a simple RFE by several miles. I also agree with dkf (too much pain for little gain), and would likely oppose a TIP to this effect.
- login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Rejected"
- status changed to: "Closed"
Ticket change [4d95826e16] (rid 139162) by sebres on 2014-08-06 19:10:20:
- closedate changed to: "2456876.29885211"
- closer changed to: "sebres"
- icomment:
> log DEBUG $Cmd "execute statement $statement, result: [break]" > In that case, the semantics of log don't matter as the break will take precedence. @dkf: no really, cause this sould definitely substitute in current scope. What I meant would be: log DEBUG $Cmd {execute statement $statement, result: [break]} So it is equivalent inside of proc "log": # set msg {execute statement $statement, result: [break]} ... if {$lev > $Level ...} { set msg [uplevel [list if 1 [list subst $msg]]] } It is like this: set msg {puts [incr i]--test} set msg [uplevel [list if 1 [list subst $msg]]] @msofer: I can write the solution, that would be not so painful. - login: "sebres"
- mimetype: "text/plain"
- username: "sebres"