« Important - the future of Melksham / Chamber of Commerce | Main | History is not always pretty »
June 29, 2009
Tcl - nice and nasty
Tcl is a lovely engineers language ... but goodness you can do some nasty things with it, and write some unmaintainable code.
set count 1
foreach type {if while} {
$type {$count < 5} {
puts "yay $type $count"
incr count
}
}
Which runs as follows:
earth-wind-and-fire:~ grahamellis$ tclsh tty
yay if 1
yay while 2
yay while 3
yay while 4
earth-wind-and-fire:~
A sign of a pure interpretative language ... the code changing from an if to a while as it runs. Is this:
a) An example of how you should NOT write code
b) An example of polymorphism when you least expect it
c) A feature looking for a benefit
d) All three of the above
And the answer is, of course, (d)
Posted by gje at June 29, 2009 09:54 PM