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''' * [Alternative Namespaces] * [Tailing widget] * [Tcl Interface to WinPCAP] * [less] * [readline] * [Angles on a compass] * [exec quotes problem] * [SNMP parser] * [WBXML] * [tedit] Tcl only text editor with Emacs like functionality (sort of). Bindtags are so cool. * [newexec] '''Random scribblings''' '''Prototype base OO''' In spirit of [selfish]: set Object(parent*) {{self} {return}} set Object(clone) { {self new} { set ::${new}(parent*) [list {self} "return $self"] proc $new args [info body $self] return; } } set Object(slot) { {self name args body} { set ::${self}($name) [list [list self {expand}$args] $body] return } } set Object(valueSlot) { {self name value} { $self slot $name {} [list return $value] return $value } } proc Object {args} { set self [lindex [info level 0] 0] set slot [lindex $args 0] # every object has the parent* slot set parents [apply [set ::${self}(parent*)] $self] if {$slot=="parent*" } { return $parents } set handled false; # should also search parents of parents set ancestors $self while {true} { set obj [lindex $ancestors 0] if {$obj eq ""} {break} set ancestors [list {expand}[lrange $ancestors 1 end] {expand}[apply [set ::${obj}(parent*)] $self]] if {[info exists ::${obj}($slot)]} { set res [apply [set ::${obj}($slot)] $self {expand}[lrange $args 1 end]] set handled true; break } } if {$handled} { return $res } else { error "slot \"$slot\" not defined for $self" } } 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] ]]