Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2017-10-19
09:30
[1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. check-in: 8e4847552a user: dkf tags: trunk
09:28 • Closed ticket [1a56550e96]: Method list introspection misses mixins plus 6 o... artifact: ead140557a user: dkf
09:24
[1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. check-in: f8310655d4 user: dkf tags: core-8-6-branch
2017-10-18
18:23
[1a56550e96] Mixins aren't being searched correctly by [info class methods -all] check-in: 5870e3c48b user: dkf tags: bug-1a56550e96
16:07 • Ticket [1a56550e96] Method list introspection misses mixins status still Ope... artifact: 1b31495b3b user: dkf
15:53 • New ticket [1a56550e96]. artifact: 5a5b064236 user: dkf

Method list introspection misses mixins

Closed / Fixed1a56550e961f282b52a99194a4d1c9ae1c4bc5d1Created 9 years agoUpdated 9 years ago
Descriptionhtml2017-10-18 15:53:49

If we run this code which has mixins in a superclass of the class of interest:

oo::class create C {
    method c {} {}
}

oo::class create D {
    mixin C
    method d {} {}
    unexport destroy
}

oo::class create E {
    superclass D
    method e {} {}
}

puts [info class methods E -all]
E create e1
puts [info object methods e1 -all]
We see that both of the introspectors find d and e but not c. This is not correct; the introspection should find all three.

Referenced by3
  • 8e4847552a[1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. check-in2017-10-19 09:30:16
  • f8310655d4[1a56550e96] Ensure that method list introspection finds methods from mixins in all cases. check-in2017-10-19 09:24:12
  • 5870e3c48b[1a56550e96] Mixins aren't being searched correctly by [info class methods -all] check-in2017-10-18 18:23:38
dkf Ticket [1a56550e96]: 4 changes [History diff]2017-10-18 16:07:04
dkfhtml2017-10-19 09:28:53

The traversal of the mixin links was in the wrong place relative to the tail-recursive unrolling inside AddClassMethodNames inside tclOOCall.c; the mixin would have been found if the class into which it had been mixed had two (or more) ordinary superclasses. Rearranging the code and adding a separate mechanism for determining how to avoid excess work seems to fix it.

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