Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2023-07-11
12:48 • Closed ticket [560c5e438c]: modernize file stat interface plus 6 other cha... artifact: 09fb63283f user: emiliano
2021-01-14
14:58 • Ticket [560c5e438c]: 3 changes artifact: c96c423f69 user: emiliano
14:45 • Add attachment filestat.diff to ticket [560c5e438c] artifact: 9c97f2bd33 user: emiliano
14:39 • Delete attachment "filestat.diff" from ticket [560c5e438c] artifact: 4f4b57d8a2 user: emiliano
10:00 • Ticket [560c5e438c] modernize file stat interface status still Open with 3... artifact: 867ff87788 user: dkf
2021-01-13
12:26 • Ticket [560c5e438c]: 3 changes artifact: e74e037b6e user: aspect
08:23 • Ticket [560c5e438c]: 4 changes artifact: 9d97adc606 user: oehhar
03:07 • Ticket [560c5e438c]: 3 changes artifact: 75566b8608 user: aspect
2021-01-05
16:15 • Add attachment filestat.diff to ticket [560c5e438c] artifact: ad562d8fae user: emiliano
16:14 • New ticket [560c5e438c] modernize file stat interface. artifact: 4f6c543230 user: emiliano

modernize [file stat] interface

Closed / Accepted560c5e438c47f5fdd34846dbb333ab96cb905416Created 6 years agoUpdated 3 years ago
Descriptionplain2021-01-05 16:14:16
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.
aspect Ticket [560c5e438c]: 3 changes [History diff]2021-01-13 03:07:26
oehharwiki2021-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

aspectplain2021-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.
dkfhtml2021-01-14 10:00:34

Looks like a good change to me.

emilianoplain2021-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.
emilianoplain2023-07-11 12:48:11
TIP 594 accepted. It will be available on 8.7
Log in (anonymous is fine) to add a comment.