tie

See: http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/tie/tie.html

(former, dead link: http://tcllib.sourceforge.net/doc/tie.html )


Array persistence. This package provides a framework for the creation of persistent Tcl array variables. It is also generic enough to allow the distribution of the contents of Tcl arrays over multiple threads and processes, i.e. communication. Persistence and communication are accomplished by tying a Tcl array variable to a data source. Examples of data sources are other Tcl arrays and files.

CMcC 20050303 - I've written a Metakit backend for tie

RLH 20050901 - When would this be included in tcllib? With the next 8.4 release?

LEG 20130509 - I'v written an Sqlite3 Data Source for Tie

AK This can go into the example area.


JGB: the problem with Tcl's implementation of Tie is that it doesn't let you have massive arrays like Perl does. With Perl's tie() the actual get/set calls in the array implementation are replaced with calls to a dbm-style-db, so that you can program with no regard for the memory use of the array. Array calls turn out to be a very handy way to work with dbm files. Of course, one can emulate this in Tcl by using Berkeley-DB's Tcl library and using it like an array.

Several months later, I discovered that Tgdbm has an "attach" feature which works just like Perl's tie(), namely it works with very large sized arrays http://www.vogel-nest.de/wiki/Main/TgdbmDoc

See also