Overview
| Artifact ID: | 81ceba675bb533a9577d7555561d1805fed0c97b |
|---|---|
| Ticket: | 3598875fffffffffffffffffffffffffffffffff
new macro TclFreeIfRefCountZero |
| User & Date: | dkf on 2012-12-31 09:47:14 |
Changes
- icomment:
Consider: Tcl_SetObjResult(interp, Tcl_NewIntObj(123)); That would have to become: Tcl_Obj *resultObj = Tcl_NewIntObj(123); Tcl_SetObjResult(interp, resultObj); Tcl_DecrRefCount(resultObj); There are a *lot* of other "simple" cases like that (e.g., appending an element to a known list) and the idiom is very common in Tcl itself. (For example, it is there in all of the error handling.) Dictionary construction is even worse. The cases that get slightly better are those where failures are possible in the "consuming" operation (such as Tcl_SetVar2Ex) but they just gain the ability to omit the Tcl_IncrRefCount from the explicit pattern; they still have all the complexity of dealing with the gory details. It also breaks code a lot. (This is from memory/experience; I wrote an OO extension — it was fast but hard to use — against 8.0a1 and maintained it through to 8.0.3 or so. The pain from switching over was high, but the code shortened quite a lot.) 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.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"