Tcl - nice and nasty
Archive - Originally posted on "The Horse's Mouth" - 2009-06-29 21:54:41 - Graham EllisTcl 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)