Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-11-13
11:18 • Closed ticket [924045ffff]: wider use of TclWordKnownAtCompileTime() plus 6 ... artifact: 7f16781485 user: serhiy.storchaka
2006-10-06
01:24 • Ticket [924045ffff]: 4 changes artifact: c1e465c8cf user: andreas_kupries
2006-09-30
01:01 • Ticket [924045ffff]: 4 changes artifact: 50004e045d user: andreas_kupries
00:51 • Ticket [924045ffff]: 1 change artifact: 447efa2000 user: msofer
2004-03-27
00:09 • Ticket [924045ffff]: 2 changes artifact: e3cf2f6d0f user: msofer
00:06 • Ticket [924045ffff]: 6 changes artifact: fd167dc56d user: msofer
2004-03-26
17:04 • New ticket [924045ffff]. artifact: 332317004f user: msofer

wider use of TclWordKnownAtCompileTime()

Closed / Fixed924045ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 19 days ago
Descriptionplain2004-03-26 17:04:33
TclWordKnownAtCompileTime() is currently only used in
compiling [return]; it should be valuable elsewhere in
the compiler, wherever tests like 
   if (tokenPtr->type == TCL_TOKEN_SIMPLE_WORD)
are made. 
It will allow compilation of scripts with a fair amount
of \uHHHH encodings in them, plus backslash-newline in
long literal strings.
msoferplain2004-03-27 00:06:32
Logged In: YES 
user_id=148712

oops -this is an RFE, not a patch
msofer Ticket [924045ffff]: 2 changes [History diff]2004-03-27 00:09:56
msofer Ticket [924045ffff]: 1 change [History diff]2006-09-30 00:51:54
andreas_kupriesplain2006-09-30 01:01:27
Logged In: YES 
user_id=75003

Oh, I have a TclLiteral function in the patch I wrote for
#86/#211. Miguel, I will send you the patch, and maybe I can
use TclWordKnownAtCompileTime as well. Notethat my patch is
against 8.4, not head.
andreas_kupriesplain2006-10-06 01:24:01
Logged In: YES 
user_id=75003

I have now compared the two functions, i.e. "TclIsLiteral"
and "TclWordKnownAtCompileTime". The general logic used by
both to decide the issue is identical (I am very glad to see
this, as it means that my understanding of the Token types
is likely correct).

What "TclWordKnownAtCompileTime" does beyond "TclIsLiteral"
is to actually assemble the literal value, if requested.

Note: The tclpro checker has commands to decide literal-ness
 and for assembly of the actual literal as well, based on
the  token list structure returned by the commands of the
Tclparser package (exposing the core parser to the script
level). I wonder if something can be done to expose
'TclWordKnownAtCompileTime' as well.

I will remove my TclISLiteral form the patch for 8.5, and
for 8.4 I will rename my function, but keep the reduced API,
i.e. no assembly of a value, only deciding literalness.
However this way the 8.5 function can be seen as 'obvious'
extension of the conditional one going into 8.4 for TIP 211ng
serhiy.storchakawiki2026-11-13 11:18:45

TclWordKnownAtCompileTime() is now used throughout the bytecode compiler (tclCompile.c, tclCompCmds*.c, tclCompExpr.c, tclAssembly.c), so words with backslash substitutions are treated as compile-time literals.

Log in (anonymous is fine) to add a comment.