|
From: Harald O. <har...@el...> - 2025-10-18 20:09:01
|
Am 17.10.2025 um 23:22 schrieb EricT:
> Hello Tcl Core Team,
>
> I have developed a working prototype implementation of TIP 672, which
> adds the $(expression) syntax as a more intuitive alternative to [expr
> {expression}].
>
> Repository: https://github.com/rocketship88/tcl-tip-672-prototype
> <https://github.com/rocketship88/tcl-tip-672-prototype>
>
> The implementation is minimal, modifying only two files (tclParse.c and
> tclNamesp.c) with approximately 100 lines of changes. The key
> modification converts the existing two-way branch in Tcl_ParseVarName to
> a three-way branch, with the new path handling $(...) by creating a
> synthetic [expr {...}] command string.
>
> Key Accomplishments:
>
> Full bytecode compilation: The synthetic string approach integrates
> seamlessly with the existing compiler, producing identical optimized
> bytecode as [expr {...}]. The disassembler output (shown in the README)
> demonstrates efficient variable loading with no runtime parsing overhead.
>
> Proven approach: Jim Tcl has used this syntax successfully for years
>
> Comprehensive testing: Works correctly with string interpolation,
> variable scoping, error handling, and interactive mode
>
> Known Limitations:
>
> Memory leak: The synthetic string is allocated but not tracked for
> cleanup in Tcl_FreeParse. This requires core team guidance on the
> preferred solution (modify Tcl_Parse structure vs. thread-local tracking).
>
> Error messages: Currently show the synthetic command rather than the
> original $(...) syntax, though this is arguably helpful for debugging.
>
> Questions for the Team:
>
> What is the preferred approach for tracking synthetic strings for cleanup?
> Is this prototype architecture acceptable for Tcl 9.x?
> Are there concerns with the synthetic string approach that I should address?
>
> The complete implementation with side-by-side diffs is available in the
> repository. I'm happy to refine the code based on your feedback and
> would appreciate any guidance on moving this forward.
>
> Best regards,
> Eric
Eric,
great proposal, thank you !
Perhaps, we may discuss this on Monday in the biweekly telco.
I am also excited and in favor to this.
Nevertheless, "$(a)" is to my knowledge a quite common syntax for
arrays. We have already killed less disruptive proposals (see optional
"- args") by endless discussions and getting nowhere.
Hope, this will be fruitful.
In addition, I would like to add the Tk test reform by the other Eric to
the biweekly topics.
Here is a revised agenda proposal proposal:
Top 1) Release calender (TIP 713)
- 9.0.3: October (2 weeks left)
- 9.1a1: November (6 weeks left)
Top 2) TIP 734 nested mutex (go or not)
Top 3) TIP 733: accessability (test status)
Top 4) TIP 732: TCL library path (discussion)
Top 5) TIP 731: use C enums (no brainer?)
Top 6) TIP 720: new bytecodes (final, great! Any issues?)
Top 7) TIP 721: Tcl_AttemptGetString
Top 8) TIP 715: supported build systems
Top 9) $($a+$b) syntax for expressions
Top 10) Tk test reform by Eric (Thanks !)
Top 11) Tcl depot and awthemes ?
Top 12) AOB
Top 13) Next meeting:
3rd of November 12:00 UTC.
Daytime saving time ends 2nd of November in US, 26th of October in
Europe.
Will we keep 12:00 UTC ? Or 13:00 UTC, so Don has 8:00 AM?
Take care,
Harald
|