TIP #182 Version 1.1: Add [expr bool] Math Function

This is not necessarily the current version of this TIP.


TIP:182
Title:Add [expr bool] Math Function
Version:$Revision: 1.1 $
Author:Joe Mistachkin <joe at mistachkin dot com>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Tuesday, 23 March 2004

Abstract

This TIP proposes a new function bool() for use with the [expr] command.

Rationale

This math function would be very useful in a number of different situations, such as:

Proposed Change

A new math function named bool would be added to the list of functions supported by the [expr] command.

expr {bool( value )}]

This would return "1" for any value of value that is non-zero (plus all non-numeric strings accepted as true by Tcl_GetBoolean()) and "0" otherwise.

Reference Implementation

A reference implementation does not yet exist. Internally, the function should use something semantically equivalent to using Tcl_GetBooleanFromObj().

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