Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |
notes:internals [2025/02/14 05:47] – [Libraries] smj-edison | notes:internals [2025/02/14 05:57] (current) – Grammerizing smj-edison |
---|
===== folk2 notes ===== | ===== folk2 notes ===== |
==== Libraries ==== | ==== Libraries ==== |
Libraries are a new concept in order to facilitate code reuse consistently across threads. Create a library using something like ''[library create myNewLib {varFromCurrentEnv} { # my library code }]''. It'll return something like ''<library:/tmp/myNewLib_TaaRfi.tcl>''. Whenever that library handle is called, it'll be lazily loaded. Lazy loading works because when an unknown command (e.g. the library handle) is called, it will execute the ''unknown'' proc. Folk will then source the library, and in the process create a namespace with the name of the library handle. With that namespace, it'll no longer call ''unknown'' (unless of course the last 6 characters change because the library was modified). | Libraries are a new concept in order to facilitate code reuse consistently across threads. Create a library using something like ''[library create myNewLib {varFromCurrentEnv} { # my library code }]''. It'll return something like ''<library:/tmp/myNewLib_TaaRfi.tcl>''. Whenever that library handle is called, it'll be lazily loaded. Lazy loading works because when an unknown command (e.g. the library handle) is called, it will execute the ''unknown'' proc. The ''unknown'' proc will then source the library, and in the process create a namespace with the name of the library handle. With that namespace, it'll no longer call ''unknown'' (unless of course the last 6 characters change because the library was modified). |