Skip to content
Tcl Source Code Artifact [db3a0b512c]
Login

Artifact [db3a0b512c]

Artifact db3a0b512cb18b2cdd1ce87b59ade9ddd81f9d4d:

Ticket change [db3a0b512c] - New ticket [3304643fffffffff|3304643fff] <i>User object info lost on more aggressive numeric conversion</i>. by sehmann on 2011-05-19 15:04:21.
D 2011-05-19T15:04:21
J assignee msofer
J cmimetype text/plain
J comment Tcl8.4\swould\sconvert\san\sobject\sto\sa\snumeric\stype\sduring\sexecution\sof\san\soperator\s(such\sas\s==)\swhen\sthe\sother\sargument\swas\sof\sa\snumeric\stype.\s\sIt\sdid\snot\sattempt\sto\sdo\sthis\sconversion\sif\sthe\sother\sargument\swas\s"",\sa\sstring,\sa\suser\sobject\stype.\n\nTcl8.5\snow\sconverts\sboth\sarguments\sblindly\swhen\scertain\soperators\s(such\sas\s==)\sare\sexecuted.\s\sThis\ssometimes\sresults\sin\sour\sobjects\s(our\sown\stypes)\sbeing\sconverted\sand\sour\sinternalRep\sbeing\sfreed.\s\sThis\scauses\sa\slarge\sportion\sof\sour\sTCL\scodebase\sto\shave\sa\sregression\swhen\sone\sof\sour\sobjects\shappens\sto\shave\sa\sstring\srep\sthat\sis\sconvertible\sto\sa\sint\s(eg.\s"123")\sor\sto\sa\sdouble\s(eg.\s"INF",\s"NAN",\s"0.5").\s\sFor\sexample\scomparing\s"INF"\s==\s""\sshould\snot\sattempt\sconvert\sboth\sto\snumeric\svalues.\n\nThe\sfundamental\sproblem\sis\sthat\sthere\sis\sno\sway\sto\sretain\sour\sobject\stype\sinformation\sor\savoid\sthese\sconversions.\s\sWe\skey\soff\sthe\stype\sto\scast\sthe\sinternalRep\spointer\sto\sour\sinternal\sC++\sobject.\s\sIf\sthis\sis\snot\sthe\sbest\sway\sto\sdo\scast\sto\sour\sinternal\sobject,\splease\slet\sus\sknow\sthe\srobustly\ssupported\sway\sof\sdoing\sthat.\n\nSome\ssolutions\swe\ssee\sare:\n1)\sdon't\sdo\sthe\saggressive\sconversion\s(ie.\sgo\sback\sto\stcl8.4\sstyle)\n2)\sonly\sattempt\snumeric\sconversion\sif\sthe\stype\sis\sone\sof\sthe\sstandard\sinternal\sTCL\stypes\sand\snot\ssome\suser-specified\stype\n3)\sadd\sa\sboolean\sto\sthe\sTCL_Object\swhich\scontrols\sthe\simmutability\sof\san\sobject\s(ie.\sdon't\sdo\sconversion\sif\sthe\sflag\sis\sset)\n4)\sadd\sa\suserdata\sfield\swhere\swe\scan\sstore\swhat\swe\sneed\s(NULL\sor\sfailure\sto\srecognize\stype\sstored\sin\sthere\smeans\snot\sour\sobject)\n\nWe\sneed\sto\sbe\sable\sto\smove\sforward\swith\stcl8.5\sand\seventually\stcl8.6\sbut\sthis\sis\sholding\sus\sback.
J foundin obsolete:\s8.5.9
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter sehmann
J subsystem 10.\sObjects
J title User\sobject\sinfo\slost\son\smore\saggressive\snumeric\sconversion
J type Bug
K 3304643fffffffffffffffffffffffffffffffff
U sehmann
Z 738c06817e5eb206fadfa769843b1cbc