Artifacts Associated With Ticket 1998221fffffffff
Ticket change [298a69d39d] (rid 88890) by mpc_janssen on 2008-06-19 20:27:08:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Executing the following script: oo::class create A { method a_with_next {} {puts a_awn ; next} method a {} {puts a_a} } oo::class create AM { method a_with_next {} {puts am_awn ; next } method a {} {puts am_a ; next} method b {} {puts a_b ; next} } oo::define A mixin AM A create a a a a a_with_next a b gives the following output: a_a a_awn am_awn a_b e.g. methods in the class are called before the methods in the mixin class. This has several consequences: 1) If a class should be extensible by a mixin, the method defined in the class should call next to run the functionality in the mixed in method. 2) because you will not know a priori if anyone would extend your class in this way you will have to end every method with a call to next 3) because of 2, next is a silent noop when no next method exists. If the call chain is changed so that mixed in methods are called first: 1) methods will not need a call to next to be extensible by mixins 2) a next with no next method can become an error again (as it should be IMO) Also note that this will then be consistent with mixins on objects, where the mixed in method *is* called before the method on the object. - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "mpc_janssen"
- subsystem initialized to: "35. TclOO Package"
- title initialized to:
class mixins are in the wrong spot in the callchain
- type initialized to: "Bug"
Ticket change [44b7be0d5d] (rid 116751) by dkf on 2008-06-20 03:41:11:
- icomment:
Logged In: YES user_id=79902 Originator: NO % namespace path oo % class create A {method a {} {puts A.a; next}} ::A % class create AM {method a {} {puts AM.a; next}} ::AM % define A mixin AM % A create a ::a % a a A.a AM.a % class create BM {method b {} {lappend ::result BM; next}} ::BM % class create B {mixin BM; method b {} {lappend ::result B; next}} ::B % set ::result {} % [B new] b % set result B BM % class create CM {method c {} {lappend ::result CM; next}} ::CM % class create C {method c {} {lappend ::result C; next}} ::C % C create c ::c % objdefine c mixin CM % set ::result {} % c c % set result CM C - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [8405012a69] (rid 117480) by dkf on 2008-06-20 03:41:39:
- priority changed to: "8"
Ticket change [e62b29e528] (rid 104252) by dkf on 2008-06-20 04:03:42:
- closedate changed to: "2008-06-19T21:03:42"
- closer changed to: "dkf"
- icomment:
Logged In: YES user_id=79902 Originator: NO Now fixed in Tcl and TclOO package
- login: "dkf"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dkf"