I had a look at this:
http://www.jadetower.org/muses/archives/000416.html
and thought to myself… hey, I could do that in Tcl in half the code. And it could also handle more than one connection:
proc DoLine {channel} {
gets $channel line
puts $channel $line
flush $channel
}
proc Server {channel clientaddr clientport} {
fileevent $channel readable [list DoLine $channel]
}
set sk [socket -server Server 6200]
fconfigure $sk -buffering line
fconfigure $sk -blocking 0
vwait forever
I find it more readable as well.
Ruby may well have some good stuff – Rails is very impressive, for instance, and I’m sure Ruby has got lots of other things going for it (like libraries, as the article mentions), but Tcl at its best does things very much the way I like them – simply and elegantly, but without taking away the possibility of doing fancier things should the need arise. Kind of like Rails:-)