Itcl - the [incr Tcl] extension

View Ticket
Login
Ticket Hash: 427ff95a382b394a8e6dbe9a7f8e1011e8a75068
Title: [namespace which] crashes Itcl 3.4.2 (against Tcl 8.5+)
Status: Closed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Resolution: Workaround
Last Modified: 2015-01-29 17:40:21
Version Found In: 3.4.2
User Comments:
dgp added on 2015-01-27 17:57:49:
About half the time this script segfaults with Tcl trunk and Itcl 3.4.2 RC:

puts "Itcl [package require Itcl]"
itcl::class Animal {
  constructor args {namespace which -variable legs}
  public variable legs 4
}
Animal .a

dgp added on 2015-01-27 18:02:15:
Itcl 3.4.2 build against Tcl 8.4.20 doesn't crash, so
this is probably another Var Reform issue never addressed.

anonymous added on 2015-01-28 03:47:27:
This could well be an incomplete futz in [3f5de3c16d]

Which Tcl headers were used to compile itcl-3.4.2? It would be useful to know if compiling agaisnta Tcl8.4 or 8.5 headers makes a difference as of the appearance of this bug - in both cases running agains Tcl8.5

dgp added on 2015-01-29 17:37:12:
So, according to miguel, Itcl 3.4.2 variable resolvers
completely fail to follow the post-Var Reform rules about
Var storage, and this segfault is a symptom of that.

The crash can be prevented by adding another check to
Tcl itself.  Doing that now.

At that point, the worst consequence is avoided, and
Itcl behaves in a way that's arguably reasonable, even
on a broken foundation.  (Itcl member variables are not
recognized as namespace vars by [namespace which], and
truly they are not.)

Actually fixing the Itcl code appears to be a major project,
which I'm not willing to take on.  Folks truly stymied by
the problem should move to Itcl 4 which doesn't suffer from it.