Artifacts Associated With Ticket 2530725
Ticket change [a1afde428b] (rid 109769) by apnadkarni on 2009-01-23 09:36:23:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
I found the behaviour exhibited in the wish session below surprising. Defining an empty constructor behaves as though no constructor was defined for the class at all. In particular, - I would expect the derived class constructor to "hide" the superclass constructor and not execute it since there is no next call. Creating a D object is seen to run the C construtor - I would expect info class constructor D to return a pair containing the arg a and an empty body - A constructor defined with an empty body behaves the same as a constructor defined with the statement "next" (or similar, there might be differences in presence mixins). That does not seem right - Adding a comment to a body changes the code that is executed - see the difference between behaviour of class D and E, the only difference being addition of a comment. This to me is the biggest NO-NO. (web) 2 % oo::class create C { > constructor {a} {set ::x $a} > } ::C (web) 3 % oo::class create D { > superclass C > constructor {a} {} > } ::D (web) 4 % info class constructor D (web) 5 % info class constructor C a {set ::x $a} (web) 6 % D create d wrong # args: should be "D create d a" (web) 7 % D create d 1 ::d (web) 8 % set x 1 (web) 10 % oo::class create E { > superclass C > constructor {a} { # Just a comment } > } ::E (web) 11 % set x 0 0 (web) 12 % E create e wrong # args: should be "E create e a" (web) 13 % E create e abc ::e (web) 14 % set x 0 /Ashok - foundin initialized to: "obsolete: 8.6b1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "apnadkarni"
- subsystem initialized to: "35. TclOO Package"
- title initialized to: "Surprising behaviour of empty constructor"
- type initialized to: "Bug"
Ticket change [c543924dbb] (rid 111968) by dkf on 2009-01-28 22:30:47:
- icomment:
If the body of a constructor (or destructor) is the empty string, the constructor(/destructor) is deleted. This is documented.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [64df5bf4a4] (rid 92846) by dkf on 2009-02-15 16:00:45:
- closedate changed to: "2009-02-15T09:00:45"
- closer changed to: "dkf"
- icomment:
allow_comments - 1
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "dkf"