Author: Jan Nijtmans <[email protected]>
State: Done
Type: Project
Tcl-Version: 9.1
Tcl-Branch: tip-711
Vote-Summary: Accepted 8/0/0
Votes-For: AK, AN, HO, JN, MC, RA, RM, SL
Votes-Against: none
Votes-Present: none
Abstract
This TIP proposes a new function Tcl_IsEmpty(), which determines whether the Tcl_Obj is the empty string, if possible without generating the string representation.
Rationale
There are several internal types, which potentially have a very large string representation (e.g. "dict", "list", "arithseries"), but they will only have a string representation of "" when they have length/size 0, which is easy to check for. Tk has an internal function ObjectIsEmpty(), exactly for this reason. Extensions should be able to benefit from this as well, without having to invent the wheel again.
Specification
Declare and implement a new function:
- int Tcl_IsEmpty(Tcl_Obj *objPtr);
This function will return 1 if the string representation of objPtr is "", 0 otherwise.
Implementation
See the tip-711 branch.
Copyright
This document has been placed in the public domain.