|
2024-08-28
| ||
| 16:42 | Merge [b0d8ee5168c1d19b]: Fix [36e5517a6850]: old style method selection in [info class methods] and... check-in: b29b368aac user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE | |
|
2024-05-16
| ||
| 08:53 | • Closed ticket [36e5517a68]: Incompatible change in behavior of -private option t... artifact: 738006777a user: dkf | |
| 08:53 | • Ticket [36e5517a68]: 3 changes artifact: a803dfaa92 user: dkf | |
| 08:53 | Fix [36e5517a6850]: old style method selection in [info class methods] and [info object methods] sti... check-in: b0d8ee5168 user: dkf tags: trunk, main | |
| 08:45 | • Ticket [36e5517a68] Incompatible change in behavior of -private option to info c... artifact: fd6e5fe322 user: dkf | |
| 08:23 | Tests to illustrate problem found in [36e5517a6850] check-in: 16cfbe1ef0 user: dkf tags: bug-36e5517a6850 | |
| 07:58 | • Ticket [36e5517a68] Incompatible change in behavior of -private option to info c... artifact: cbaf70c7f9 user: dkf | |
| 07:52 | • Ticket [36e5517a68]: 3 changes artifact: 38119435e8 user: dkf | |
| 06:52 | • Ticket [36e5517a68]: 4 changes artifact: 5e4e46fde0 user: oehhar | |
|
2024-05-15
| ||
| 18:49 | • Ticket [36e5517a68]: 3 changes artifact: 557f639746 user: dkf | |
| 18:42 | • Ticket [36e5517a68]: 3 changes artifact: 723390302a user: dkf | |
|
2024-05-03
| ||
| 07:18 | • Ticket [36e5517a68]: 4 changes artifact: 0461952a8f user: oehhar | |
| 07:09 | • Ticket [36e5517a68]: 3 changes artifact: 522a4fdef3 user: apnadkarni | |
| 06:50 | • New ticket [36e5517a68]. artifact: efd9aa32c2 user: apnadkarni | |
Incompatible change in behavior of -private option to info class methods command
In 8.6
% oo::class create C {method Private {} {}; method public {} {}}
::C
% info class methods ::C
public
% info class methods ::C -private
public Private
The above works as documented as the -private option will return private methods in addition to public methods as stated in the manpage If the -private flag is given, the list of methods will also include the private... (note the "also").
In Tcl 9, this is not the case
% oo::class create C {method Private {} {}; method public {} {}}
::C
% info class methods ::C
public
% info class methods ::C -private
Private
Note the -private option now returns only private methods. However, the documentation still seems to match 8.6 behavior: If the -private flag is given, and the -scope flag is not given, the list of methods will also include the non-exported methods of the class
I'm not sure if the Tcl 9 implementation needs to be fixed or the documentation. If the latter, an Tcl 8 incompatibility note would be desirable.
Great catch! I hope, Donal will comment. Some tests here would be great too...
Thanks, Harald
I don't recall specifically changing this.
The only likely looking changes would be from 9294775086c983a3 (TIP #500) and the result of that particular call is supposed to remain identical. (info class methods $cls -scope private would be different...)
I really thought I had test cases for all this.
Donal, thank you looking into this.
So, the answer is, that this change was not intentional and "-private" should list public and private methods.
That is an important statement. Perhaps other Wizards may find the cause...
Thank you for all, Harald
It should list exactly the methods listed in 8.6. However, the set of possible methods is expanded:
oo::class create C {
method foo {} {}
method Bar {} {}
private method gorp {} {}
}
puts [info class methods C -private]
This should list foo and Bar (in some order) but not gorp; that should only be present if -scope private is passed (and then that only fetches gorp; -scope doesn't work the same way).
The problem likely lies between:
InfoClassMethodsCmd(and probably alsoInfoObjectMethodsCmd) in tclOOInfo.c,TclOOGetSortedMethodListandTclOOGetSortedClassMethodListin tclOOCall.c, and- the testing of
info class methods(and probablyinfo object methods) in oo.test (aroundoo-17.*would have been the right place)
I'm particularly irritated that there isn't a test of this case.
tclOOCall.c is uninvolved; that's only ever used when the -all option is passed.
Will be fixed by bug-36e5517a6850.