Skip to content

Update TclX for Tcl 9 API compatibility#27

Open
zolk3ri wants to merge 20 commits into
flightaware:masterfrom
zolk3ri:tcl9-api-compat
Open

Update TclX for Tcl 9 API compatibility#27
zolk3ri wants to merge 20 commits into
flightaware:masterfrom
zolk3ri:tcl9-api-compat

Conversation

@zolk3ri
Copy link
Copy Markdown

@zolk3ri zolk3ri commented May 3, 2026

The current TclX implementation depends on several Tcl 8-era APIs and compatibility assumptions that no longer hold with Tcl 9. This PR updates TclX for Tcl 9 API compatibility, allowing it to build, load, and pass the main test suite against Tcl 9.1a2.

Problem Description

  • TclX fails to compile against Tcl 9 because many Tcl APIs now use Tcl_Size instead of int
  • TclX still uses Tcl 8-era APIs and types that are no longer available in Tcl 9
  • Package initialization requests Tcl 8 compatibility, which prevents loading under Tcl 9
  • Legacy TclX index expressions such as len, len-3, end-1, and arithmetic expressions like 3*2 no longer work with Tcl 9’s stricter index parsing
  • Some variable assignment paths use flags that cause changed behavior under Tcl 9
  • Library conversion does not handle Tcl 9-style tclIndex entries using source -encoding
  • Some legacy TclX library helpers need small command-syntax compatibility updates for Tcl 9

The original implementation was written for Tcl 8 and assumes APIs and parser behavior that have changed in Tcl 9. This PR updates those assumptions while preserving TclX’s historical command behavior where practical.

Implementation Details

This PR updates TclX internals for Tcl 9 while keeping the public TclX command behavior compatible with the existing tests.

Key implementation changes:

  • Updated string, list, and object length handling to use Tcl_Size
  • Updated package initialization for Tcl 9 compatibility
  • Replaced removed legacy math function registration with Tcl-level compatibility commands
  • Restored TclX legacy relative index expression handling
  • Fixed variable assignment behavior affected by Tcl 9 parsing flag changes
  • Fixed chmod mode parsing so leading-zero mode strings keep TclX’s historical octal behavior
  • Fixed convlib handling of Tcl 9 tclIndex entries using source -encoding
  • Fixed read_file ... nonewline handling for Tcl 9’s read -nonewline syntax
  • Fixed dup handling for Tcl 9 channel names such as file5
  • Updated tests/build behavior so the Tcl 9 main test suite can run reliably

Design Decisions

  1. Preserve TclX compatibility:

    • TclX historically accepts index expressions such as len-3, end-1, and 3*2
    • Tcl 9’s stricter parsing rejects some of these forms directly
    • The compatibility code restores TclX’s older behavior instead of changing command semantics
  2. Keep the port conservative:

    • The goal is not to redesign TclX
    • Changes are limited to API compatibility, parser behavior compatibility, and test-suite reliability
    • Existing TclX public behavior is preserved where practical

Testing

Tested with Tcl 9.1a2.

The TclX main test suite passes:

Total   953
Passed  947
Skipped 6
Failed  0

The current TclX implementation depends on several Tcl 8-era
APIs and compatibility assumptions that no longer hold with Tcl
9. This commit updates TclX for Tcl 9 API compatibility,
allowing it to build, load, and pass the main test suite
against Tcl 9.1.
@resuna
Copy link
Copy Markdown
Member

resuna commented May 4, 2026

The CI builds against Tcl8, that will need to be updated for this branch.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 4, 2026

The CI builds against Tcl8, that will need to be updated for this branch.

Oh, I missed it. My bad. I will work on it.

zolk3ri added 3 commits May 5, 2026 00:27
Build Tcl 9.1a1 from the core-9-1-a1 branch in Linux and macOS
GitHub Actions instead of using Tcl 8.6.

The workflows now clone the Tcl source branch, build and
install Tcl during CI, locate the installed tclConfig.sh and
tclsh paths dynamically, verify the Tcl patchlevel, and pass
the discovered Tcl configuration directory to configure.
Stop adding ppa:ubuntu-toolchain-r/test in the Linux CI
workflow.

Ubuntu Noble provides gcc-11 and g++-11 through the standard
repositories, so the external PPA is unnecessary and can cause
CI failures when Launchpad is unreachable.
Add stricter Tcl version validation to the Linux and macOS CI
workflows.

The workflows now source the discovered tclConfig.sh, combine
TCL_VERSION and TCL_PATCH_LEVEL to verify the expected Tcl
9.1a1 version, and keep the tclsh patchlevel check using
EXPECTED_TCL_VERSION. This ensures CI does not accidentally
configure against a different Tcl installation.

The workflow YAML files were also formatted with yamlfmt.
@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 4, 2026

OK, I updated the CI workflows to build against Tcl 9.1a1.

Linux passes locally with act, and both workflow files pass actionlint. I could not test the macOS workflow locally because act cannot emulate GitHub’s macOS runners, so that should be verified by GitHub Actions.

I also removed the obsolete Ubuntu toolchain PPA and added stricter checks to ensure CI uses the expected Tcl installation.

The workflow YAML files were also formatted with yamlfmt.

zolk3ri added 3 commits May 5, 2026 16:20
The macOS GitHub Actions runner does not provide autoreconf by
default, which caused the Mac CI configure step to fail before
the build started.

Since the generated configure script is checked in again, run
it directly instead of regenerating it in CI.
Drop unused helper functions added for Tcl 9 compatibility in
the chmod, list, and string command implementations.

The list and string commands already use the existing TclX
index parsing paths where needed, preserving TclX arithmetic
index expression semantics. The chmod mode parser was also
unused, so keeping it only required compiler-specific unused
annotations without changing behavior.

This removes dead code and avoids carrying compatibility
wrappers that have no callers.
Tcl 9 uses Tcl_Size for string lengths returned by Tcl object
APIs, so local variables and helper parameters that receive
those lengths should use Tcl_Size as well.

Update the TclX_EchoObjCmd length variable and the string helper
input-length parameters, while keeping ExpandString's existing
int output-length interface for its callers.
@zolk3ri zolk3ri force-pushed the tcl9-api-compat branch from d4ca069 to 0bf3a5a Compare May 5, 2026 14:27
@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 5, 2026

Mac CI should work now. :)

The macOS CI failure happened because autoreconf is not available on the runner. Since configure is committed, the workflow now runs it directly instead of regenerating it during the macOS build.

@resuna
Copy link
Copy Markdown
Member

resuna commented May 5, 2026

Both Mac and Linux tests claim it passes but:

Mac:

dup.test
make: *** [test] Segmentation fault: 11
Error: Process completed with exit code 2.

Linux:

dup.test
make: *** [Makefile:232: test] Segmentation fault (core dumped)
Error: Process completed with exit code 2.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 5, 2026

Both Mac and Linux tests claim it passes but:

Mac:

dup.test
make: *** [test] Segmentation fault: 11
Error: Process completed with exit code 2.

Linux:

dup.test
make: *** [Makefile:232: test] Segmentation fault (core dumped)
Error: Process completed with exit code 2.

I am working on it as we speak. :)

zolk3ri added 2 commits May 5, 2026 19:42
Add a smoke test step to the Linux and macOS CI workflows after
the build step and before the full test suite.

The smoke test loads TclX from the build directory via
TCLLIBPATH and sets TCLX_LIBRARY so the extension can find the
TclX script library before installation. It verifies the
package and runtime versions, prints the loaded shared library,
and asserts results from a small set of TclX string commands.

This gives CI an early hard failure if the built TclX library
cannot be loaded or basic commands return unexpected results,
even where the broader test suite is allowed to continue on
error.
Use Tcl_GetIntFromObj when parsing numeric dup arguments as
file descriptors instead of converting through
Tcl_GetObjType("int").

Tcl object type names are internal details and
Tcl_GetObjType("int") is not a safe public conversion path.
Under Tcl 9 this can return NULL, causing Tcl_ConvertToType to
segfault when dup handles an invalid numeric file descriptor
such as dup 100.

Using Tcl_GetIntFromObj avoids that internal type lookup and
lets the invalid file descriptor path report the expected POSIX
EBADF error.

Keep the existing channel-first lookup so numeric-looking
channel names are not mistaken for file descriptors.
@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 5, 2026

Both Mac and Linux tests claim it passes but:

Mac:

dup.test
make: *** [test] Segmentation fault: 11
Error: Process completed with exit code 2.

Linux:

dup.test
make: *** [Makefile:232: test] Segmentation fault (core dumped)
Error: Process completed with exit code 2.

Thanks, that was a real issue in dup.test.

I tracked it to the dup 100 case. The code was using Tcl_ConvertToType with Tcl_GetObjType("int") to parse numeric file descriptor arguments. Under Tcl 9 that internal object type lookup can return NULL, causing the segfault.

I changed it to use Tcl_GetIntFromObj instead, so the invalid descriptor path now reports the expected POSIX EBADF error instead of crashing.

I also updated the CI smoke test to exercise the build-tree TclX before installation more cleanly. It now sets TCLX_LIBRARY so the loaded extension can find the build-tree tclx.tcl script library, and it asserts the results of a few basic TclX commands instead of only printing them.

After rebuilding locally, dup.test now passes through dup-5.9 and completes successfully with no segfault.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 6, 2026

If this PR lands, I will follow up with a separate cleanup PR to fix the compiler warnings it exposes and add the necessary range checks (posssibly, will have to think about it) and related defensive checks. :)

@zolk3ri zolk3ri marked this pull request as draft May 7, 2026 00:42
@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 7, 2026

I fixed another Tcl 9 compatibility issue in this branch: profile was still relying on Tcl 8-era command dispatch assumptions.

The profile fix restores the saved Tcl_CmdInfo before dispatch, adds Tcl 9 objProc2 handling, avoids direct Tcl object internals access in the tailcall check, detects Tcl procedures by their delete hook, and updates the Tcl 9 profile stack expectations.

Tested after a clean rebuild with Tcl 9.1a2:

make clean
make
TCLLIBPATH="$PWD" TCLX_LIBRARY="$PWD/library" tclsh9.1 tests/all.tcl

Result:

Tests ended at Thu May 07 15:13:01 CEST 2026
all.tcl:        Total   1015    Passed  1004    Skipped 11      Failed  0
Sourced 0 Test Files.
Number of tests skipped for each constraint:
        7       pcOnly
        4       tclx_test_eval

@zolk3ri zolk3ri marked this pull request as ready for review May 7, 2026 13:22
@resuna
Copy link
Copy Markdown
Member

resuna commented May 7, 2026

I tracked it to the dup 100 case. The code was using Tcl_ConvertToType with Tcl_GetObjType("int") to parse numeric file descriptor arguments. Under Tcl 9 that internal object type lookup can return NULL, causing the segfault.

I changed it to use Tcl_GetIntFromObj instead, so the invalid descriptor path now reports the expected POSIX EBADF error instead of crashing.

Good call, TclGetIntFromObj is the idiomatic API.

@resuna
Copy link
Copy Markdown
Member

resuna commented May 7, 2026

It looks like it's still building a libtclX8.6.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 7, 2026

I pushed two follow-up commits after rechecking Tcl 8.6 compatibility:

  • 2bd5891 adds a Tcl 8.6 compatibility shim for Tcl_Size / TCL_SIZE_MODIFIER, so the Tcl 9-oriented size cleanups still compile against Tcl 8.6.
  • f182f97 adjusts lmatch-2.3 to accept the Tcl 8.6 regexp diagnostic text while preserving the Tcl 9 expectation.

I also verified the branch against Tcl 8.6.17 with a plain ./configure, followed by make and make test.

The Tcl 8.6 interpreter used for that run was:

/usr/bin/tclsh8.6 (8.6.17)

Result:

Tests ended at Thu May 07 16:12:46 CEST 2026
all.tcl:        Total   1712    Passed  1701    Skipped 11      Failed  0
Sourced 0 Test Files.
Number of tests skipped for each constraint:
        7       pcOnly
        4       tclx_test_eval
====== SUCCESS =====

Most importantly, regarding the library name question:

It looks like it's still building a libtclX8.6.

I rechecked the Tcl 9 build configuration. When configured explicitly against my Tcl 9.1a2 build, the generated Makefile contains:

PKG_LIB_FILE    = libtclx8.6.so
PACKAGE_VERSION = 8.6
TCL_BIN_DIR     = /home/zolk3ri/.local/pkg/tcl-9.1/lib
TCL_SRC_DIR     = /home/zolk3ri/lab/sourcegate/tcl/tcl-git

So the build is using Tcl 9 headers/configuration, but the produced library name still comes from the TclX package version (8.6), not from the configured Tcl core version.

Would you prefer this compatibility branch to keep producing libtclx8.6.so, or should the library/package naming be adjusted for Tcl 9 builds? If the latter is desired, one possible approach would be to derive the generated library name from the Tcl version selected by configure, but I did not want to make that packaging change without confirmation.

@resuna
Copy link
Copy Markdown
Member

resuna commented May 7, 2026

It should build a library that reflects the Tcl version it's built with, no? Am I missing something?

Shoudln't the TclX package version match the Tcl version?

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 8, 2026

It should build a library that reflects the Tcl version it's built with, no? Am I missing something?

Shoudln't the TclX package version match the Tcl version?

Yes, that makes sense. You are not missing anything, I believe.

I had initially treated the existing 8.6 value as a fixed TclX package version, so I kept it stable while doing the Tcl 9 compatibility work. Looking at it again, though, I think that was the wrong interpretation: this value appears to be intended to follow the Tcl version used for the build.

So I will update the branch so the generated TclX package/library version follows the Tcl version used for the build. In other words, a Tcl 8.6 build should continue to produce/provide Tclx 8.6, while a Tcl 9.x build should produce/provide the matching Tclx 9.x package/library.

I will make sure the generated pkgIndex.tcl, the shared library name, and package provide Tclx ... all use the same build Tcl version, then retest with both Tcl 8.6 and Tcl 9.x.

If there is also a separate TclX release-version convention I should preserve, please let me know, but my current understanding is that the package/library version should follow the Tcl build version. Am I understanding that correctly?

@zolk3ri zolk3ri marked this pull request as draft May 8, 2026 05:38
@resuna
Copy link
Copy Markdown
Member

resuna commented May 8, 2026

Yes, you are understanding it correctly. TclX post-4 major/minor tracks the Tcl version, and patch tracks the Tcl version where possible. It started as "4" and out of sync because Tcl3 hadn't been updated in so long.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 9, 2026

Yes, you are understanding it correctly. TclX post-4 major/minor tracks the Tcl version, and patch tracks the Tcl version where possible. It started as "4" and out of sync because Tcl3 hadn't been updated in so long.

Thanks, that clarification helped.

I pushed two commits addressing this:

  • tests now require the Tclx package version matching the running Tcl major/minor version instead of hard-coding Tclx 8.4/8.6
  • configure now derives the TclX package/library version from the detected Tcl version after loading tclConfig.sh

I also want to point out why the PR stats look larger than the actual functional change. One commit removes legacy form-feed characters (^L) from the generic C sources:

  • 9f6b827 Remove form-feed separators from generic sources

That cleanup accounts for a substantial part of the changed-line count, but it is mechanical formatting cleanup only. It does not intentionally change TclX behavior. I can revert this commit if you would rather keep this PR limited to the functional changes.

I retested both Tcl 8.6 and Tcl 9.1 builds after the versioning changes.

The resulting behavior is now:

  • Tcl 8.6 build:

    • provides Tclx 8.6
    • builds libtclx8.6.so
    • generates pkgIndex.tcl requiring Tclx 8.6
    • infox version reports the Tcl 8.6 patchlevel-derived full version
  • Tcl 9.1 build:

    • provides Tclx 9.1
    • builds libtclx9.1.so
    • generates pkgIndex.tcl requiring Tclx 9.1
    • infox version reports the Tcl 9.1 patchlevel-derived full version

Both test runs completed successfully with zero failures.

Does this now match the versioning behavior you had in mind?

@zolk3ri zolk3ri marked this pull request as ready for review May 9, 2026 15:42
@resuna
Copy link
Copy Markdown
Member

resuna commented May 11, 2026

I also want to point out why the PR stats look larger than the actual functional change. One commit removes legacy form-feed characters (^L) from the generic C sources:

* `9f6b827 Remove form-feed separators from generic sources`

That cleanup accounts for a substantial part of the changed-line count, but it is mechanical formatting cleanup only. It does not intentionally change TclX behavior. I can revert this commit if you would rather keep this PR limited to the functional changes.

Yes, I think that should be a separate cleanup operation.

Does this now match the versioning behavior you had in mind?

Yes, that is clean and correct.

zolk3ri added 10 commits May 11, 2026 22:30
Tcl 9 can dispatch commands through Tcl_ObjCmdProc2 when
isNativeObjectProc is 2. Add a Tcl 9 wrapper for that entry
point and install it when the profiler temporarily rewrites
command information.

Restore the exact Tcl_CmdInfo captured by the trace callback
before dispatching the original command. Restoring selected
fields can leave a mixed wrapper/original command state when
newer Tcl versions add command dispatch fields.

Initialize the replacement Tcl_CmdInfo from the saved command
info before modifying it, so Tcl_SetCommandInfoFromToken
receives fully initialized version-specific fields.

Use Tcl_GetString for the tailcall check instead of inspecting
Tcl_Obj internals directly.
Under Tcl 9, command dispatch may use native object wrappers
and Tcl_ObjCmdProc2, so objProc and objClientData are not
reliable indicators of whether a command is a Tcl procedure.
Looking the command up again by name is also unnecessary
because the trace callback already provides the command token
and saved command info.

Use TclProcDeleteProc as the Tcl procedure marker. This
preserves ordinary proc-only profiling while avoiding native
commands such as join in proc-only mode.
Tcl 9 command dispatch does not produce the same uplevel stack
entries in the profile-3.2 and profile-3.4 cases. Keep the
existing Tcl 8 expectations and add Tcl 9-specific expected
result lists.

The profiler behavior now matches the Tcl 9 command dispatch
model while preserving the old Tcl 8 expectations.
Use package vsatisfies with the provided Tcl package version
when selecting Tcl 9 profile expectations.

This avoids numeric comparison of tcl_version and keeps the
test branch selection aligned with Tcl package version
semantics while remaining compatible with Tcl 8.6 and Tcl 9.
Tcl_Size and TCL_SIZE_MODIFIER are provided by Tcl 9, but this
branch also needs to build against Tcl 8.6. Add a small
compatibility shim that maps Tcl_Size to int for Tcl 8.6 and
defines an empty printf modifier.

This lets Tcl 9-oriented size cleanups compile with Tcl 8.6
while using the native Tcl_Size definitions when building
against Tcl 9.
Tcl 8.6 and Tcl 9 report the invalid regexp pattern in
lmatch-2.3 with different diagnostic text. Select the expected
message using Tcl package version checks so the test passes
with both Tcl 8.6 and Tcl 9.
The TclX package version now follows the Tcl major/minor
version used for the build. Tests that hard-code Tclx 8.4 or
Tclx 8.6 therefore fail or abort when the package is built
against Tcl 9.x and provides Tclx 9.x.

Derive the required Tclx major/minor version from the running
Tcl interpreter in all.tcl, testlib.tcl, and arrayproc.test.
This preserves the existing Tcl 8.6 behavior while allowing the
same test suite to run against Tcl 9.x builds.
TclX post-4 package versions are intended to track the Tcl
version used for the build. Major and minor versions follow
Tcl's major and minor version, and the patch level follows
Tcl's patch level where possible.

Derive PACKAGE_VERSION from TCL_VERSION after loading
tclConfig.sh so the generated package version, shared library
suffix, pkgIndex.tcl entry, and Tcl_PkgProvide version all use
the detected Tcl major/minor version.

Derive FULL_VERSION from TCL_VERSION and TCL_PATCH_LEVEL so
infox version and the tcl_findLibrary lookup reflect the build
Tcl patch level where it is available.

This keeps Tcl 8.6 builds providing Tclx 8.6 with an 8.6.x full
version, while Tcl 9.x builds provide the matching Tclx 9.x
package and full version.
AC_INIT already defines PACKAGE_VERSION and PACKAGE_STRING from
the static package metadata. The TclX package/library version
is later derived from the detected Tcl version after loading
tclConfig.sh.

Undefine the AC_INIT-provided PACKAGE_VERSION and
PACKAGE_STRING definitions before defining the Tcl-derived
values, so strict builds with -Werror do not fail on
command-line macro redefinition warnings.

This preserves the TclX version-tracking behavior while keeping
the generated compiler definitions unambiguous.
After avoiding redefinition of Autoconf's PACKAGE_VERSION
macro, the Tcl-derived TclX package version is exposed as
TCLX_PACKAGE_VERSION.

Use that macro for runtime TclX initialization as well as
Tcl_PkgProvide, so Tcl 9 builds search for and report the TclX
package version that matches the generated library and
pkgIndex.
@zolk3ri zolk3ri force-pushed the tcl9-api-compat branch from d39219c to 7418f4d Compare May 11, 2026 20:36
@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 11, 2026

I removed the unrelated form-feed cleanup from this PR and force-pushed the branch so that cleanup can be handled separately.

The remaining large line count is now mostly from the checked-in generated configure script. Excluding configure, the local PR diff is:

16 files changed, 495 insertions(+), 239 deletions(-)

Since this repository commits configure and the workflows use it directly, I left the regenerated file included with the configure.in changes. The generated configure diff is mainly from running Autoconf after the configure.in update (autoreconf/autoconf).

I also retested the rebased branch with clean Tcl 8.6 and Tcl 9.1 builds. Both completed successfully with zero test failures.

Comment thread generic/tclXlist.c Outdated

if (Tcl_SetVar2Ex(interp, varName, NULL, listVarPtr,
TCL_PARSE_PART1| TCL_LEAVE_ERR_MSG) == NULL) {
0| TCL_LEAVE_ERR_MSG) == NULL) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elide the "0|"? :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Fixed it here: b2dd2d2.

Comment thread generic/tclXmath.c
*-----------------------------------------------------------------------------
* $Id: tclXmath.c,v 1.2 2005/03/16 23:48:21 hobbs Exp $
*-----------------------------------------------------------------------------
* Tcl 9 compatibility shim for TclX math support.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting design change.

Copy link
Copy Markdown
Author

@zolk3ri zolk3ri May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was intentional, but it is definitely a design tradeoff rather than the only possible approach.

The old TclX math code followed the older C-side math-function registration structure. For this port I moved the compatibility behavior into a Tcl-level shim to keep the Tcl 9 changes smaller and avoid adding more C-side compatibility code around that older expression/math-function interface.

That said, if you would prefer this to stay closer to the original C implementation style, I can rework it. A hybrid approach may also be reasonable: keep the implementation logic in C where appropriate, but expose the Tcl 9-compatible registration/wrapping at the Tcl level.

Let me know your thoughts!


If your comment was mainly about the file header change rather
than the implementation structure, then yes, that was intentional too, though I can make it less abrupt.

Since tclXmath.c is no longer carrying the old C-side math implementation in the same way, I changed the header to describe its current role as the Tcl 9 compatibility entry point. But I am happy to preserve more of the original wording/history there if that would be preferable!


Either way, let me know. :)

Copy link
Copy Markdown
Author

@zolk3ri zolk3ri May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, thinking about this more, a closer-to-C implementation may be reasonable here.

The old code used the older C-side math-function registration style. I moved this into a Tcl-level compatibility shim to keep the Tcl 9 port smaller, but Tcl math functions can also be represented as commands in ::tcl::mathfunc. So another approach would be to keep the implementation logic in C and register TclX’s math functions there with Tcl_CreateObjCommand, which should be a cleaner cross-version structure than preserving the older Tcl_CreateMathFunc style.

If you prefer that direction, I can rework this part. Let me know your thoughts please.

@resuna
Copy link
Copy Markdown
Member

resuna commented May 12, 2026

I notice there's a lot of trailing whitespace elimination noise but I think that's OK.

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 12, 2026

I notice there's a lot of trailing whitespace elimination noise but I think that's OK.

There was quite a bit more unrelated cleanup noise at one point, including form-feed separator removal and broader trailing-whitespace cleanup, but I pulled most of that back out so this PR stays focused on the Tcl 9 compatibility work.

I may do that cleanup separately later (already fixed all compiler warnings BTW) if needed or if that would not be problematic. :P

@zolk3ri
Copy link
Copy Markdown
Author

zolk3ri commented May 15, 2026

One more note on the PR size: most of the remaining line churn comes from the regenerated checked-in configure script.

The actual source change is in configure.in, but this repository commits configure, and the workflows use the checked-in script directly. I therefore regenerated configure with Autoconf so normal builds and CI see the versioning changes from configure.in.

Excluding configure, the local PR diff is:

16 files changed, 495 insertions(+), 239 deletions(-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants