Ticket UUID: | 560c5e438c47f5fdd34846dbb333ab96cb905416 | |||
Title: | modernize [file stat] interface | |||
Type: | RFE | Version: | 8.7 | |
Submitter: | emiliano | Created on: | 2021-01-05 16:14:16 | |
Subsystem: | 16. Commands A-H | Assigned To: | nobody | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2023-07-11 12:48:11 | |
Resolution: | Accepted | Closed By: | emiliano | |
Closed on: | 2023-07-11 12:48:11 | |||
Description: |
This change makes the `varName` argument to [file stat] optional, introducing a 1-argument form. The 2-argument form is unchanged. The new 1-argument form produces the same errors, but on success returns its result as a dictionary instead of populating an array in the caller's namespace. The dictionary result is identical with what would be stored in the array. Calling [file stat] with one argument previously raised a {TCL WRONGARGS} error, so this change can be considered backward-compatible. Returning a dictionary is beneficial in that it can be passed & returned by value between procs, it can be processed by [dict] commands and the caller has full control over whether and how to store it in a variable. Attached patch implements such behaviour. Note that tests cmdAH-28.1 and cmdAH-28.2 are affected by this change. The patch address this issue as well. | |||
User Comments: |
emiliano added on 2023-07-11 12:48:11:
TIP 594 accepted. It will be available on 8.7 emiliano added on 2021-01-14 14:58:49: Added a new patch with the same changes for [file lstat]. Both commands share semantics and implementation, so it seems to me incomplete to implement the change for one and leave the other as is. TIP 594 should be updted to reflect this change. dkf added on 2021-01-14 10:00:34: Looks like a good change to me. aspect added on 2021-01-13 12:26:39: https://core.tcl-lang.org/tips/doc/trunk/tip/594.md Listed Emiliano as primary author since he contributed the idea and the patch. Any errors in the tip text are mine. oehhar added on 2021-01-13 08:23:30: Emiliano, I appreciate your great contribution. As it is a user visible change, a TIP is required. If you don't have commit rights to core.tcl-lang.org/tips , please ask for it to drive the process. Thank you, Harald |
Attachments:
- filestat.diff [download] added by emiliano on 2021-01-14 14:45:55. [details]