Real name Mark Janssen (Tcl Chatroom nick: mjanssen). I have been using Tcl since 2004 and I love it.
There are several reasons I love Tcl:
Current projects
Pages I contributed to
Random ideas I like to pursue
TODO
Autoexpansion of leading word
Until I find a better spot to put this, the following patch will change Tcl so it will autoexpand leading words (at least to a point where you can experiment with it)
diff --git a/tcl/generic/tclParse.c b/tcl/generic/tclParse.c index b06b106..02b126f 100644 --- a/tcl/generic/tclParse.c +++ b/tcl/generic/tclParse.c @@ -266,6 +266,8 @@ Tcl_ParseCommand( const char *termPtr; /* Set by Tcl_ParseBraces/QuotedString to * point to char after terminating one. */ int scanned; + int expandWord; + int firstWord; if ((start == NULL) && (numBytes != 0)) { if (interp != NULL) { @@ -307,8 +309,14 @@ Tcl_ParseCommand( */ parsePtr->commandStart = src; + firstWord = 1; while (1) { - int expandWord = 0; + if (firstWord) { + expandWord = 1; + firstWord = 0; + } else { + expandWord = 0; + } /* * Create the token for the word. diff --git a/tcl/library/clock.tcl b/tcl/library/clock.tcl index 7411fd6..6d1bb7a 100644 --- a/tcl/library/clock.tcl +++ b/tcl/library/clock.tcl @@ -693,7 +693,7 @@ proc ::tcl::clock::format { args } { [ParseClockFormatFormat $procName $format $locale] } - return [$procName $clockval $timezone] + return [[list $procName] $clockval $timezone] }
This allows data structures like TOOT with {expand}. To demonstrate that example:
% set m {matrix {{1 2 3} {4 5 6} {7 8 9}} } % proc matrix {matrix {method {}} args} { if {$method eq {}} { # return the 'typeless' matrix return $matrix } switch $method { row { return [lindex $matrix [lindex $args 0]] } } } % $m ; #gives the undecorated matrix {1 2 3} {4 5 6} {7 8 9} % $m row 1 4 5 6
Which is a thing of beauty IMO.
Everything I post on the wiki is in the public domain unless explicitly marked otherwise. I would love to hear if some of it was useful to you though.