TIP #347 Version 1.3: Add 'string is bignum' to the 'string is' Subcommand

This is not necessarily the current version of this TIP.


TIP:347
Title:Add 'string is bignum' to the 'string is' Subcommand
Version:$Revision: 1.3 $
Author:Jos Decoster <jos dot decoster at gmail dot com>
State:Draft
Type:Project
Tcl-Version:8.7
Vote:Pending
Created:Monday, 09 February 2009
Discussions To:news:comp.lang.tcl
Keywords:Tcl

Abstract

The string command supports tests for a number of Tcl's basic types, for example, integers, doubles, and booleans. This TIP proposes adding bignum integers, as was done for wide integers in TIP #188.

Rationale

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

Specification

This document proposes augmenting the string is command with a string is bignum 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 bignum integer (that is, acceptable to Tcl_GetBignumFromObj) possibly surrounded by whitespace.

Reference Implementation

Patches that implement string is bignum, provide test cases for it, and update doc/string.n to include it are available at SourceForge as Tcl Patch #2581150[1].

Copyright

This document has been placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows