|
2026-10-22
| ||
| 17:19 | • Ticket [3075155fff] oo depends on bytecoding? status still Closed with 3 oth... artifact: c540e25f95 user: serhiy.storchaka | |
|
2026-10-21
| ||
| 10:03 | • Closed ticket [3075155fff]. artifact: 71835cb9ec user: serhiy.storchaka | |
|
2011-03-11
| ||
| 18:56 | • Ticket [3075155fff]: 4 changes artifact: d864046948 user: dkf | |
| 18:47 | • Ticket [3075155fff]: 1 change artifact: a83b87227b user: dkf | |
| 18:47 | • Ticket [3075155fff]: 4 changes artifact: 633e210957 user: dkf | |
|
2010-10-20
| ||
| 06:36 | • Ticket [3075155fff]: 1 change artifact: 64c538f86f user: dkf | |
| 06:36 | • Ticket [3075155fff]: 5 changes artifact: 47250e52dc user: dkf | |
|
2010-09-27
| ||
| 22:43 | • Ticket [3075155fff]: 4 changes artifact: 7e11b72900 user: msofer | |
| 17:08 | • Ticket [3075155fff]: 4 changes artifact: 0f540e1336 user: msofer | |
| 17:08 | • Add attachment show.tcl to ticket [3075155fff] artifact: 1421a4ab3f user: msofer | |
| 17:07 | • Ticket [3075155fff] oo depends on bytecoding? status still Open with 4 other... artifact: 09cec41220 user: msofer | |
| 16:24 | • Ticket [3075155fff]: 4 changes artifact: f602081b7a user: msofer | |
|
2010-09-26
| ||
| 19:54 | • Ticket [3075155fff]: 4 changes artifact: 0c74dec6dc user: msofer | |
| 19:04 | • Ticket [3075155fff]: 4 changes artifact: f4b53565ee user: msofer | |
| 19:03 | • Ticket [3075155fff]: 4 changes artifact: 8a5be61dcd user: msofer | |
| 00:53 | • Ticket [3075155fff]: 4 changes artifact: 43871c015c user: dkf | |
|
2010-09-24
| ||
| 22:03 | • New ticket [3075155fff]. artifact: b22fb677f4 user: msofer | |
oo depends on bytecoding?
Closed / Fixed3075155fffffffffffffffffffffffffffffffffCreated 16 years agoUpdated 41 days ago
Descriptionplain2010-09-24 22:03:10
When I disable the command compiler (juts add '0&&' at the start of the condition in tclCompile.c line 1639), there is a nasty-looking error:
==== oo-27.6 variables declaration - non-interference of levels FAILED
==== Contents of test case:
oo::class create foo {
superclass master
variable x!
constructor {} {set x! 1}
method y {} {incr x!}
}
foo create bar
oo::objdefine bar {
variable y!
method y {} {list [next] [incr y!] [info var] [info local]}
export eval
}
bar y
list [bar y] [lsort [info object vars bar]] [bar eval {info vars *!}]
---- Result was:
{3 2 {} {}} {x! y!} {x! y!}
---- Result should have been (exact matching):
{3 2 y! {}} {x! y!} {x! y!}
==== oo-27.6 FAILED
There is also a segfault in itcl's typeoption.test, which may well be related.
The build is configured as
CFLAGS=-DPURIFY ./configure --disable-shared --enable-symbols
dkfplain2010-09-26 00:53:48
Variable resolver involved! Argh!
msoferplain2010-09-26 19:03:16
From the chat: [14:56]dkfmiguel: It looks like it's something to do with variable resolvers. I don't pretend to understand those (and have probably got it wrong, I accept) and write code for them by doing the equivalent of throwing rocks at stuff until it seems to work. [14:57]dkfI suspect that the highly restricted resolver used by TclOO is too restricted, but since proc^Wmethod bodies are always compiled I don't care
msoferplain2010-09-26 19:04:51
After quick look at TclInfoVarsCmd(), it seems that [info vars] is not resolver-aware at all
msoferplain2010-09-26 19:54:51
This led to discovery of (related, not the same) Bug #3075907. If that one is resolved as an implementation bug, this test is wrong. If it is instead a doc bug, this test is correct.
msoferplain2010-09-27 16:24:05
The problem seems to be: 1. On a normal build, the presence of y! is detected at compile time by the [incr] compiler. This causes y! to live in the LVT and the resolver to be called at proc loading time. Due to #3075907 y! is reported by [info vars] 2. With command compilers disabled (in this particular case, it is enough to not compile incr), y! is not in the LVT: it will only exist when it is given a value This is all as should be, assuming [info vars] behaved as doc'ed in the man page. Given #3075907 the behaviour depends on the set of commands that are bytecompiled.
msoferplain2010-09-27 17:07:44
Just replacing [incr] by an equivalent [myIncr] or forcing a non-bc'ed [incr] displays the difference: running the attached script outputs
{3 2 y! {}} {x! y!} {x! y!}
{3 2 {} {}} {x! y!} {x! y!}
{3 2 {} {}} {x! y!} {x! y!}
msoferplain2010-09-27 17:08:08
File Added - 387998: show.tcl
msoferplain2010-09-27 22:43:12
In order for this to work properly if we maintain the current behaviour (ie, if #3075907 is declared a doc bug), we should extend Tcl_ResolverInfo to contain a listProc to be used by [info vars]. This new function would list all variable names that are able to be resolved in the current context. The alternative would probably be unnecessarily expensive: that all OO methods be initialised to contain locals linked to every defined variable, initially undefined.
dkfplain2010-10-20 06:36:04
Your analysis looks correct. I'll assign it to you (for now) since I'm not going to do any hacking in the guts of resolvers if I can possibly help it.
dkf Ticket [3075155fff]: 1 change
[History diff]2010-10-20 06:36:25
dkfplain2011-03-11 18:47:07
I'm not very excited about this after all. Turns out quite a bit of the rest of Tcl also breaks if we disable command compilation.
dkf Ticket [3075155fff]: 1 change
[History diff]2011-03-11 18:47:08
dkfplain2011-03-11 18:56:06
It's the interaction of [info variables] with variable resolvers (a feature not used in the rest of the core, hence the bug showing up in TclOO). Having a LVT smooths all that out in this case, but that's hardly ideal.
serhiy.storchakawiki2026-10-21 10:03:36
Since 8.6.0 ([0b5e337729], bug [2712377]), [info vars] in a method lists the declared object variables itself, so the result no longer depends on bytecompilation. The show.tcl cases give the same result on 8.6 and 9.x.
serhiy.storchaka Ticket [3075155fff]: 3 changes
[History diff]2026-10-22 17:19:30
Log in (anonymous is fine) to add a comment.
Attachments:
- show.tcl [download] added by msofer on 2010-09-27 17:08:08. [details]