TIP 163: A [dict merge] Subcommand

Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Author:		Joe English <[email protected]>
State:		Final
Type:		Project
Tcl-Version:	8.5
Vote:		Done
Created:	14-Nov-2003
Tcl-Ticket:	745851


This TIP proposes a new [dict] subcommand which is used to combine multiple dictionaries.


	dict merge ''dictVal1'' ''dictVal2'' ''...'' ''dictValN''

Returns a new dictionary containing all the key/value pairs in dictVal1 through dictValN. In the case of duplicate keys, values from later arguments override those from earlier ones.


See SF Patch #745851 http://sourceforge.net/support/tracker.php?aid=745851


See the EXAMPLES section of return(n), which currently reads:

 set options [eval [list dict create -level 1] $args]

This could be replaced with

 set options [dict merge {-level 1} $args]


This feature was suggested during the discussion of [111], but since the vote was already in progress it was not considered at that time.


This document has been placed in the public domain.