Posted to tcl by Rothgar at Mon Dec 10 13:39:57 GMT 2007view raw

  1. # Constants
  2. set ::constants [list]
  3.  
  4. # Constant Handling
  5. rename proc _proc
  6.  
  7. _proc const {name value} {
  8. global constants;
  9.  
  10. lappend constants $name $value;
  11. }
  12.  
  13. _proc proc {name argpat body} {
  14. global constants;
  15. _proc $name $argpat [string map $constants $body];
  16. }
  17.  
  18. const STRING_MAX_LEN 400;
  19.  
  20. proc test {nick arg} {
  21. putlog "TEST: $STRING_MAX_LEN";
  22. }
  23.