<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://www.tcl.tk/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Thu May 23 22:36:27 GMT 2013 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='273'>
<header><title>Add Tcl_Expr... Support to Tcl_Get... Functions</title><author address="mailto:tcl@javalite.com">Carsten Gosvig</author><status type='project' state='rejected' tclversion="8.5" vote='after'>$Revision: 1.5 $</status><history></history><created day='30' month='aug' year='2006' /><obsoletes tip='176'/></header>
<abstract>This TIP proposes adding <emph style="bold">Tcl_Expr</emph>... calls to <emph style="bold">Tcl_Get</emph>... functions, supporting direct use of expressions for arguments to commands that is defined as int, long, wide-int, double or boolean.</abstract>
<body><section title="Rationale">
<para>Many of Tcl&apos;s commands takes an int, long, wide-int, double or boolean as an argument. For list and string commands even in the format of <emph style="bold">end-</emph><emph style="italic">N</emph>. However, this is limited to a direct string conversion of the argument to one of the mentioned types, so for even simple expression the <emph style="bold">expr</emph> command has to be called explicitly, which is quite cumbersome as can be seen in the following examples:</para>
<verbatim><vline encoding='base64'>c2V0IHggW2xzZWFyY2ggJGxpc3QgJGVsZW1d</vline><vline encoding='base64'>c2V0IG5ldyBbbHJhbmdlICRsaXN0IFtleHByICR4LTFdIFtleHByICR4KzFdXQ==</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IHggW3N0cmluZyBmaXJzdCAkc3RyaW5nICJmb28iXQ==</vline><vline encoding='base64'>c2V0IG5ldyBbc3RyaW5nIHJhbmdlICRzdHJpbmcgJHggW2V4cHIgWyR4KzVdXQ==</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IHggW2xzZWFyY2ggJGxpc3QgJGVsZW1d</vline><vline encoding='base64'>c2V0IGhleCBbZm9ybWF0ICIlWCIgW2V4cHIgeyR4ICYgMHhGRn1dXQ==</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IGZpbGUgW29wZW4gJG5hbWVd</vline><vline encoding='base64'>c2V0IGJ1ZiBbcmVhZCAkZmlsZSBbZXhwciB7JGxlbiAqIDIgLSAxMH1dXQ==</vline><vline encoding='base64'></vline><vline encoding='base64'>aW5jciB2YXIgW2V4cHIgJHN0ZXAqNSsxXQ==</vline><vline encoding='base64'>YWZ0ZXIgW2V4cHIgJHNlYyoxMDAwXQ==</vline></verbatim>
</section>
<section title="Specification">
<para>By adding a call to a <emph style="bold">Tcl_Expr</emph>... function at the point where the current conversion fails in the <emph style="bold">Tcl_Get</emph>... functions (at the label named <emph style="italic">bad</emph> in the current implementation) we will add support for using expressions directly as arguments without needing to go through the <emph style="bold">expr</emph> command:</para>
<verbatim><vline encoding='base64'>c2V0IHggW2xzZWFyY2ggJGxpc3QgJGVsZW1d</vline><vline encoding='base64'>c2V0IG5ldyBbbHJhbmdlICRsaXN0ICR4LTEgJHgrMV0=</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IHggW3N0cmluZyBmaXJzdCAkc3RyaW5nICJmb28iXQ==</vline><vline encoding='base64'>c2V0IG5ldyBbc3RyaW5nIHJhbmdlICRzdHJpbmcgJHggJHgrNV0=</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IHggW2xzZWFyY2ggJGxpc3QgJGVsZW1d</vline><vline encoding='base64'>c2V0IGhleCBbZm9ybWF0ICIlWCIgeyR4ICYgMHhGRn1d</vline><vline encoding='base64'></vline><vline encoding='base64'>c2V0IGZpbGUgW29wZW4gJG5hbWVd</vline><vline encoding='base64'>c2V0IGJ1ZiBbcmVhZCAkZmlsZSB7JGxlbiAqIDIgLSAxMH1d</vline><vline encoding='base64'></vline><vline encoding='base64'>aW5jciB2YXIgJHN0ZXAqNSsx</vline><vline encoding='base64'>YWZ0ZXIgJHNlYyoxMDAw</vline></verbatim>
<para>This TIP does not propose any alterations to any function or procedure signatures.</para>
<subsection title="Implementation Notes">
<para>The <emph style="bold">Tcl_Get</emph>&lt;<emph style="italic">Type</emph>&gt; functions needs to be updated with a call to the <emph style="bold">Tcl_Expr</emph>&lt;<emph style="italic">Type</emph>&gt; functions, and the <emph style="bold">Tcl_Get</emph>&lt;<emph style="italic">Type</emph>&gt;<emph style="bold">FromObj</emph> functions need to be updated with a call to the <emph style="bold">Tcl_Expr</emph>&lt;<emph style="italic">Type</emph>&gt;<emph style="bold">Obj</emph> functions.</para>
</subsection>
<subsection title="Compatibility">
<para>There should be no compability issues, as this TIP only adds functionality to a current error situation.</para>
<para>This proposal renders <tipref type="text" tip="176"/> obsolete, as that describes a solution that is effectively a subset of this TIP.</para>
</subsection>
</section>
<section title="Copyright">
<para>This document has been placed in the public domain.</para>
</section>
</body></TIP>
