|
From: EricT <tw...@gm...> - 2025-10-18 20:59:11
|
Thank you for the positive feedback and for raising this in Monday's telco!
I'm encouraged by your support.
Regarding $(a) - you're right that reading an empty array element with a
variable index is a valid construct. However, this is explicitly addressed
in the TIP and the repository README. The workarounds are straightforward:
${(a)} # Braced form
[set (a)] # Command substitution
Both still work. In fact, code using $(varname) could be proactively
modified to use ${(varname)} to indicate the clear intent of an empty array
reference, which improves readability. The security, performance, and
usability benefits of $(...) seemed to justify this trade-off for Tcl 9.x
where some incompatibilities are expected.
Given your interest in the feature, would you be willing to consider
sponsoring TIP 672? The implementation is working and minimal (~100 lines
across two files), with the main open question being the preferred approach
for tracking synthetic strings for cleanup. Your guidance on that
architectural decision would be particularly valuable.
The prototype repository with full implementation and examples is here:
https://github.com/rocketship88/tcl-tip-672-prototype
Looking forward to the results of the discussion on Monday! I won't be able
to join the telco discussion, but I'm available via email for any questions
or clarifications that arise.
On Sat, Oct 18, 2025 at 1:09 PM Harald Oehlmann <har...@el...>
wrote:
> 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
>
> _______________________________________________
> Tcl-Core mailing list
> Tcl...@li...
> https://lists.sourceforge.net/lists/listinfo/tcl-core
>
|