From: da S. P. J <pet...@fl...> - 2025-07-17 15:37:25
|
I don’t think the implementation matters, what I mean is that functionally it’s a specialized array/dict. From: Emiliano <emi...@gm...> Date: Wednesday, July 16, 2025 at 11:48 To: da Silva, Peter J (USA) <pet...@fl...> Cc: tcl...@li... <tcl...@li...> Subject: Re: [TCLCORE] biweekly telco on14th of July at 12:00 UTC On Wed, 16 Jul 2025 14: 15: 46 +0000 "da Silva, Peter J " <peter. dasilva@ flightaware. com> wrote: > Is this a specialized array/dict? There seems considerable overlap. No, it isn't. As specified in TIP 369, the payload of the cargo command On Wed, 16 Jul 2025 14:15:46 +0000 "da Silva, Peter J " <pet...@fl...> wrote: > Is this a specialized array/dict? There seems considerable overlap. No, it isn't. As specified in TIP 369, the payload of the cargo command is a dictionary, so I used a dict Tcl_Obj, but could have used a hash table. Quoting the TIP: "It is proposed that a cargo subcommand be added to most widgets that will allow the user to store data related to the widget in a data dictionary. With the cargo command there are three parameters that can go with it: set, unset, and get. Set adds and alters entries in the cargo dictionary. pathName cargo set name value ?name value ...? " Nothing special here. The main point is coupling the data lifetime to widget lifetime. The difference is syntax; it would become $cargocmd set pathName name value ?name value ...? A simple use case is the tooltip package: it holds the display data in an array, indexed by widget name and, optionally, by a tag or index, separated by a comma. When a widget with an entry in the array is destroyed, no automatic cleanup is done; one must call the cleanup subcommand to delete the data. If the package used a cargo table instead, the cleanup is automatic. Regards -- Emiliano <emi...@gm...> |