Version 24 of MJ

Updated 2006-09-14 19:38:27 by MJ

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:

  • It supports Unicode in code and GUI
  • It is truely interactive: Open a console in your application and see what is really going on
  • Tclkit or Starkit deployment is very, very convenient
  • It is very easy to install libraries without changing config files all over the place
  • The community is great
  • Very simple syntax and everything is a string: This allows for some funcky stuff like redefining proc
  • The C-API is one of the easiest of any of the ones I have seen (Perl, Python, Ruby) this makes it very easy to wrap C libraries. See for an example readline

Pages I contributed to

Random scribblings

In 8.5 Tcl could implement the command [cmd subcommand args] in three ways:

  • A core command with subcommands (offering no introspection)
  • A namespace ensemble command
  • An object method dispatch

It seems it would be nice if the core commands (string, file, package etc.) could be implemented using either OO or namespace ensembles. This will allow for better introspection possibilities (e.g. cmd info commands) to list the valid subcommands. So IDE writers will not have to parse errors anymore to display possible completions. As a demonstration of the concept see the code below (requires Tcl 8.5)

 package require XOTcl

 namespace import ::xotcl::*

 # wrap all procs that allow subcommands in a XOTcl object and hide the original
 # this has the advantage that $proc info commands can display subcommands

 interp alias {} dotcl {} interp invokehidden {} 

 set procs_to_hide {file string package info namespace}

 foreach proc $procs_to_hide {
   interp hide {} $proc
   Object create $proc
   $proc set name $proc
   # define unknown in case we miss subcommands
   $proc proc unknown {args} {
     puts "XOTcl wrapper for '[my set name]' called with args: $args"
     return [dotcl [my set name] {expand}$args]
   }
 }

 file proc join {args} {
   return [dotcl file join {expand}$args]
 }


 puts [file join a b c]
 puts [file info commands]

[ Category Person ]