Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-09-12
12:32 • Closed ticket [0b9200888e]: TIP #660 breaks TIP #628/#630 plus 6 other chang... artifact: f4f2ec2486 user: jan.nijtmans
2023-05-03
16:00 • Ticket [0b9200888e]: 3 changes artifact: faba159396 user: pooryorick
15:41 • Ticket [0b9200888e]: 3 changes artifact: 8ac7baacba user: jan.nijtmans
15:30 • Ticket [0b9200888e]: 3 changes artifact: 2ad2a71063 user: pooryorick
10:41 • Open ticket [0b9200888e]. artifact: 06a98d2913 user: jan.nijtmans
2023-04-16
18:25 • Ticket [0b9200888e]: 5 changes artifact: e8c55f6c90 user: jan.nijtmans
12:51 • Ticket [0b9200888e]: 5 changes artifact: cbfc325cc7 user: apnadkarni
2023-04-13
14:08 • Ticket [0b9200888e]: 5 changes artifact: 5ace570423 user: jan.nijtmans
2023-04-12
13:28 • Ticket [0b9200888e]: 5 changes artifact: 275e942d55 user: apnadkarni
08:58 • Closed ticket [0b9200888e]. artifact: 0973ab2930 user: jan.nijtmans
08:58
Fix [0b9200888e]: TIP #660 breaks TIP #628/#630 check-in: 796eb2ec4b user: jan.nijtmans tags: tip-660
2023-04-11
22:53 • Ticket [0b9200888e] TIP #660 breaks TIP #628/#630 status still Open with 3 o... artifact: f1878ef83f user: jan.nijtmans
22:50
Proposed fix for [0b9200888e]: TIP #660 breaks TIP #628/#630 closed check-in: a409b62d34 user: jan.nijtmans tags: bug-0b9200888e
22:49 • New ticket [0b9200888e] TIP #660 breaks TIP #628/#630. artifact: a455a71cb8 user: jan.nijtmans

TIP #660 breaks TIP #628/#630

Closed / Fixed0b9200888e2fd6dd14fee5fc8471f6e8cb864a96Created 4 years agoUpdated 3 years ago
Descriptionwiki2023-04-11 22:49:40
A testcase showing the problem is pkgt.c, in the unix/dltest directory

This function does:

    Tcl_CreateObjCommand2(interp, "pkgt_eq", Pkgt_EqObjCmd2, NULL, NULL);
    Tcl_CreateObjTrace2(interp, 0, 0, TraceProc2, NULL, NULL);

The "2" API is supposed to register 64-bit capable commands/traces. But with TIP #660, the types are using Tcl_Size, which is "int" when compiled for Tcl 8.7. That doesn't match the 8.7 version of tcl.h. So, the functions registered have the wrong signature then. Solution: the typedefs for Tcl_CmdObjTraceProc2 and Tcl_ObjCmdProc2 should use ptrdiff_t, not Tcl_Size

Referenced by2
jan.nijtmanswiki2023-04-11 22:53:14

Proposed fix [here]

jan.nijtmanswiki2023-04-12 08:58:44

Fixed [here]

apnadkarnimarkdown2023-04-12 13:28:03

Thanks for the fix but I'm not sure that is the right solution. I don't believe from a practical point of view the "2" API's will ever be functional on Tcl 8.7 with 64-bit width. (As an aside, I'm doubtful that even 32-bit Tcl 9 will usefully support that internally but that is another matter.)

Given that, I think the "2" API's should really be defined as dealing with Tcl_Size width objc in both Tcl 8.7 and Tcl 9 as opposed to 64-bit widths. For 8.7 then, and 32-bit Tcl 9, they would be functionally equivalent to their non-"2" counterparts and present only for source compatibility with 64-bit builds that do support (in the future) the larger objc range.

But I don't find this distinction sufficiently important to discuss so I'm ok with whatever you decide.

/Ashok

jan.nijtmanswiki2023-04-13 14:08:18

Follow-up [here], regarding TIP #627.

I'm aware that you don't care about breaking earlier TIP's, that's why I'm jumping in here. TIP #660 does not describe its effects on other TIP's other than #494.

One day you will discover that Tcl_MethodCallProc2 and Tcl_NRCallObjProc2 are still using size_t, and you will be tempted to change it to Tcl_Size. That's wrong for the same reasons I already explained, whether you like it or not!

apnadkarnimarkdown2023-04-16 12:51:04

I think you missed my point. I'm saying that 8.7 API's should NOT be introducing API's that take 64-bit arguments in the first place. To achieve the intended purpose of source compatibility, the older Tcl_CreateObjCommand etc. would continue to take int parameters. The new "2" version would take Tcl_Size parameters, not size_t or ptrdiff_t. The purpose is source compatibility, not 64-bit length support in Tcl 8.7 which is completely pointless.

Regarding your comment on TIP 660 not mentioning TIP's other than 494, it does say primarily 494 and does not enumerate all the other TIP's because I felt there was no point in enumerating every single TIP that switched parameters from signed to unsigned. It does say all parameters to public and private API's referring to lengths and indices will be changed to signed.

Also, you are wrong about my not caring about breaking earlier TIP's. But it is true that I don't care to stick to previous TIP's that were themselves broken to begin with as gospel! 494 was in that category and that led to 660. I view others like "2" definitions that use 64-bit lengths that serve no practical purpose in 8.7 the same way, but unlike 494, not critical.

/Ashok

jan.nijtmanswiki2023-04-16 18:25:27

> Also, you are wrong about my not caring about breaking earlier TIP's

Well, just saw [this] commit, which I expected you were overlooking. That's - indeed - the right thing to do, so I'm finally glad you didn't overlook. Instead of discussing the usefulness of past (accepted) TIP's, let's focus on real work. The challenge in TIP #660 is already big enough.

jan.nijtmanswiki2023-05-03 10:41:55

Re-opening, because commit [cd426d20a9327f49] broke it again.

Nathan, please revert this change. See discussion below

pooryorickwiki2023-05-03 15:30:02

I was going to reply, but now see that TIP 666 addresses this, so maybe that's good enough (assuming it passes).

jan.nijtmanswiki2023-05-03 15:41:37

Note: the TIP number is pure coincidence!

pooryorickwiki2023-05-03 16:00:58

The devil is in the details ;)

jan.nijtmanswiki2023-09-12 12:32:01

Since TIP #666 is accepted and merged now, Tcl 8.7 and 9.0 are once-again source-compatible. So, this ticket can be closed now, once and for all.

Log in (anonymous is fine) to add a comment.