Artifacts Associated With Ticket 1489011fff
Ticket change [5ab639ab92] (rid 118190) by dgp on 2006-05-15 17:43:52:
- assignee initialized to: "kennykb"
- cmimetype initialized to: "text/plain"
- comment initialized to:
dgpIn Tcl 8.4, the only way to create a new math function is via Tcl_CreateMathFunc [13:17]dgpUsing that interface, the return type of the function had to be ont of the supported C types of the Tcl_Value struct. [13:18]dgpso mathfuncs were only good for computing numerical things [13:18]tclguyyes [13:18]dgpWith TIP 232 in place, that restriction is lifted... [13:20]dgp% proc tcl::mathfunc::append {args} { return [join $args ""] } % expr {append("foo","bar","soom")} foobarsoom [13:21]dgpIs this new ability an intended improvement? Or an unintended implementation consquence? [13:21]dkf_dgp: improvement [13:22]dkf_I don't know about "intended" though [13:22]dgpdon't judge too quickly... [13:23]dkf_What I can say is that I know how bad it was before, having tried to write new functions using that old API [13:23]dgp% expr {append("N","a","N")} domain error: argument not in valid range [13:24]dgpif the [expr] core is supposed to check for numeric-ness of the result of a function, then screening out NaN's might make sense. [13:24]dgpbut if we intend string functions to work, we need to stop doing that. [13:25]dkf_Earlier on, I said that NaN was "the screaming horror hiding in the space between the 1s and the 0s" and I meant it [13:26]spjuthTry: expr {append("0","x","AF")} [13:26]dgpsame interp: % expr {sqrt(-1)} NaN(7ffffffffffff) [13:26]dgpso either way, the HEAD is currently buggy/inconsistent [13:26]dkf_it's the cvtToNumeric opcode that's wacky [13:26]dgpbut I'd like to know my opinions about which way correctness lies aren't in gross conflict with others. [13:27]dgp% expr {append("0","x","AF")} 175 [13:30]dkf_What would fail if line tclCompExpr.c:260 was commented out? [13:30]dgpI'll test and find out... [13:30]dkf_since I think that's what is causing the problem [13:32]dgpwhy is that line inactive in the sqrt() example? [13:32]dkf_probably a buggy INST_TRY_CVT_TO_NUMERIC implementation [13:34]dgpdkf, mucho failures regarding string rep of numbers [13:34]dgp[expr] apparently is supposed to produce canonical string reps [13:35]dgp% expr 0x1 1 spjuthMight be that sqrt(-1) contains a unary minus operator, thus INST_TRY_ is skipped. - foundin initialized to: "obsolete: 8.5a5"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "47. Bytecode Compiler"
- title initialized to: "mathfuncs return strings? numbers?"
- type initialized to: "Bug"
Ticket change [49d4fd3744] (rid 100109) by kennykb on 2006-07-31 05:53:45:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=99768 Ouch. I don't know, either. When I put the TIP together, I was thinking only of the new numeric types (chiefly bigints) and not of strings. It's obvious that we should try to convert a string to numeric if we pass it into something (such as an arithmetic operator) that requires a number. It's also a historical fact that people use [expr {$x}] to make $x into a canonical number - it is expected that [expr 0xff] will return 255. So it appears, for well or ill, that [expr] is for numbers, and not for strings, as attractive as the latter seems. Perhaps we should TRY_CVT_TO_NUMERIC on the result of math functions? - login: "kennykb"
- mimetype: "text/plain"
- username: "kennykb"
Ticket change [2927b14807] (rid 88823) by dgp on 2006-09-01 03:14:38:
- closedate changed to: "2006-08-31T20:14:38"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 This is now a Dup of 1541274
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Duplicate"
- status changed to: "Closed"
- username: "dgp"