Ticket UUID: | 70f3b23caddc1a1cf77a3f7ed7daa6f9f6405ee5 | |||
Title: | Tcl_InitStubs: is the "-" in the version requirement "8.5-" allowed? | |||
Type: | Bug | Version: | 8.6 - 9.0 | |
Submitter: | oehhar | Created on: | 2024-12-15 17:46:31 | |
Subsystem: | 70. Sample Extension | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2025-01-30 13:15:26 | |
Resolution: | Fixed | Closed By: | oehhar | |
Closed on: | 2025-01-30 13:15:26 | |||
Description: |
The wiki page for extension migration https://core.tcl-lang.org/tcl/wiki?name=Migrating+C+extensions+to+Tcl+9&p contains: #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.5-", 0) == NULL) #else if (Tcl_PkgRequire(interp, "Tcl", "8.5-", 0) == NULL) #endif { return TCL_ERROR; } This might be wrong in two senses:
Also, the sample extension is related here. Here is the TCL 8.6. description stating, that only numbers and dots are allowed: https://core.tcl-lang.org/tcl/file?name=doc/InitStubs.3&ci=84c07aaa29698bb8&ln=23-24 IMHO, the "PackageRequire" capability without "USE_TCL_STUBS" is also undocumented. Here is the 9.0 (main) description which is identical: https://core.tcl-lang.org/tcl/file?udc=1&ln=on&ci=tip&name=doc%2FInitStubs.3 THanks to Francois to point-out this issue. | |||
User Comments: |
oehhar added on 2025-01-30 13:15:26:
Mnetioned in the Migration wiki page of TCL by [efbd9d4fb4] and Tk by https://core.tcl-lang.org/tk/info/2775ca08f78b27ab. I think, this is the best place for this information. Thanks, Harald jan.nijtmans added on 2025-01-13 09:56:43: I have no objection, mentioning this in the release notes. I don't know anyone calling Tcl_InitStubs(.... , 1). We should recommend the 'exact' parameter to be 0 always. There's no use-case for making it 1 (or -1, if you like). In C, printing a boolean always gives '1' or '0', never '-1'. oehhar added on 2025-01-13 09:11:22: Ok, thanks, great work. I was trapped by my own trap ;-). The change of the strict parameter from boolean to "list of flags" should be mentioned in the release notes. Remark that at least in machine language, a boolean 1 is always "-1" (all bits set) and not "1" (only LSB set). Thank you and take care, Harald jan.nijtmans added on 2025-01-13 08:35:04: > Would it be a good idea also to add the 3rd form "8.6-9" ? No, because "8.6-9" is exactly the same as "8.6", I see no added value. What you probably mean is "8.6-10" (because the max-value is _exclusive_, remember ....), Which means that all between 8.6 (inclusive) and 10.0 (exclusive) works. It's exactly this risk, people forgetting that the end-value is _exclusive_ why I prefer "8.6-" more than "8.6-10". Whether Tcl 10.0 will work or not, is not a concern yet, I don't think we will see Tcl 10.0 before my pension. oehhar added on 2025-01-13 07:25:15: Thanks, great. The new text mentions "8.6", "8.6-", but not "8.6-9". Would it be a good idea also to add the 3rd form "8.6-9" ? Thanks, Harald jan.nijtmans added on 2025-01-12 18:15:04: Merged to [5d7aa913b0164aec|trunk] and other branches. Since this is a doc-fix only, no need to mention this in changes.md fvogel added on 2025-01-10 19:57:38: Nice, thanks! jan.nijtmans added on 2025-01-10 14:06:42: Another [7512a6295d64bab9|attempt] to make things more clear without too much bloat. fvogel added on 2025-01-07 06:47:12: One point regarding Jan's attempt to clarify even more in the man pages in [3200a10430]: The comments following each line of code must be correct as of now only. As time passes and more Tcl version come out we will have to remember to update these comments. That's why I'm not 100% comfortable with this commit. I would see a pointer to the "VERSION NUMBERS" section and to the package vatisfies section of the [package] man page as a better alternative since those are much less specific. apnadkarni added on 2025-01-07 03:05:10: To clarify, what I was trying to say is that I saw no use for the version parameter. In my view the argument passed to For example, the extension might say Put it differently, the jan.nijtmans added on 2025-01-06 22:19:08: In most cases "8.6" is the right answer. After conversion to work with 9.0, "8.6-" or "8.6-10" is the right answer. Who is still interested in 8.5? And 8.7 doesn't exist yet. oehhar added on 2025-01-06 21:27:53: Thanks, Jan ! Nor Don, nor Ashok have any clue what to put into the version field. So, your light is really required. Thanks, Harald jan.nijtmans added on 2025-01-06 21:24:28: > Ashok proposed to use "TCL_VERSION" as content This is a bad idea. I created a [09218bf9618b1c29|demo] why. (try this with Linux or gcc on Windows) oehhar added on 2025-01-06 18:21:28: Thanks, Jan, for looking into this. Jan, we need your light here. The last meeting revealed other issues:
Sorry, but this may be subject of the next telco. So, we get Jans light.... Take care, Harald jan.nijtmans added on 2025-01-03 14:52:12: Looks good to me. Just one minor remark and an addition: [90436ee9e3ff3b1f] +1 for merge to trunk and 8.7 oehhar added on 2024-12-20 10:21:18: Possible merge is postponed after 9.0.1 release. Thanks for all, Harald oehhar added on 2024-12-16 11:51:45: Propose new wording for the documentation with checkin [607aea587f] of branch [70f3b23cad-docs-version-requirement]. Comments welcome ! Harald jan.nijtmans added on 2024-12-15 22:11:25: The enhanced "package" syntax is described in TIP #268, and is available since Tcl 8.5. Apparently, "InitStubs.3" was never adapted to describe the enhanced TIP #268 syntax. fvogel added on 2024-12-15 18:28:09: Regarding the dash "-" char: from a very quick look at the code it seems the actual version is obtained through tcl_PkgRequireEx, which *I think* calls Tcl_PkgRequireEx, which allows version numbers as documented for package require. So I think that it's probably the documentation that should be improved. But don't take this as certain since I didn't check sufficiently in depth. |
