TIP 188: Add 'string is wideinteger' to the 'string is' Subcommand

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Author:         Kevin Kenny <kennykb@acm.org>
State:          Final
Type:           Project
Vote:           Done
Created:        23-Apr-2004
Post-History:   
Discussions-To: news:comp.lang.tcl
Keywords:       Tcl
Tcl-Version:    8.5

Abstract

The string command supports tests for a number of Tcl's basic types, for example, integers, doubles, and booleans. This TIP proposes adding wide integers.

Rationale

The string command includes tests for the common Tcl types: string is boolean, string is double and string is integer. Unaccountably, string is wideinteger is missing from the list, making it difficult for an input validation procedure to determine whether, in fact, a string contains a valid wide integer.

Specification

This document proposes augmenting the string is command with a string is wideinteger that functions the same as string is integer in every respect except for the fact that it accepts any string containing a substring that is valid as a wide integer (that is, acceptable to Tcl_GetWideIntFromObj) possibly surrounded by whitespace.

Reference Implementation

Patches that implement string is wideinteger, provide test cases for it, and update doc/string.n to include it are available at SourceForge as Tcl Patch #940915http://sf.net/tracker/?func=detail&atid=310894&aid=940915&group_id=10894 .

Copyright

Copyright 2004, by Kevin B. Kenny. Redistribution permitted under the terms of the Open Publication License http://www.opencontent.org/openpub/ .

History