Overview
| Artifact ID: | edb43f46a89d276aefbdfe88aecccac9fcba1664 |
|---|---|
| Ticket: | 3598875fffffffffffffffffffffffffffffffff
new macro TclFreeIfRefCountZero |
| User & Date: | ferrieux on 2012-12-31 18:19:26 |
Changes
- icomment:
> Tcl_SetObjResult(interp, Tcl_NewIntObj(123)); > .... would have to become: > Tcl_Obj *resultObj = Tcl_NewIntObj(123); > Tcl_SetObjResult(interp, resultObj); > Tcl_DecrRefCount(resultObj); Unless, of course, the contract of SetObjResult is altered to *not* incrRefCount ! Obviously, after a decade of existence, the create-at-zero principle has pervaded all APIs, and I am not minimizing the cost of a switch. But a fair evaluation must take this "contamination" into account and allow for each solution to assume cooperation from the rest ;) > Code written for one pattern cannot be converted to the other > by macro. Yes, we've agreed to look at breaking things where > necessary, but this is a lot of breakage for very questionable gain. *This* is the winning argument ! Thanks for recording it here; now we can proceed with Jan's TclFreeIfRefCountZero macro, which respects the current semantics but allows for a cleaner refcount/lifecycle rule for objects: now they should only exceptionally die at -1.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"