Tcl in a hybrid of RealLife and More Equal Pigs

Fast forward 2 years. Our happy new Tcl coder AH (Anonymous Hacker) has just finished implementing a HTTP webcrawler using the http package when the phone rings.

AH we are having some problems with connections being dropped. Can you do some debugging?
No problem, I will get to it straight away.

AH renames the http command to http_ and creates a subclass http which overrides the connect method, to trace when connections are made. After restarting his application again AH notices that he is opening way too many connections. He fixes the bug and leaves in the debug code so he can trace the connections being set up. After that he goes home feeling very happy.

FF 2 months

In his free time AH is writing a scrabble application and he wants to be able to scramble a string. With his new found knowledge he is confident this should take no more than 30 minutes and starts writing.

 % <some oo command to create a method> string scramble {} {# scramble string}
 error string is not an object.

Very surprised AH starts searching the Tcl wiki to find out what might be going on here, when he stumbles upon namespace ensembles. Thinking he found the way to do it AH happily goes to work again:

 % <command to add subcommands to namespace ensemble> string scramble {} {# scramble string}
 error string is not a namespace

Getting a little bit annoyed now, AH decides to take the more involved way (everything is cmd args after all) and renames string to _string creates a new string command that checks if the first arg is scramble and otherwise calls _string with {something here}$args.

After getting it to work after almost a day of hacking, AH is a bit annoyed but happy it is working.

FF 6 months

After upgrading the http package to a newer version for even better HTTP2.0 support, suddenly the phone rings, it's PHB.

AH what did you do?! All our webcrawler scripts are crashing.

AH quickly rolls back to the older http version and starts to investigate (of course he should have tested first but thats why he is _A_H)

As it turns out the new maintainer of the http package really dislikes OO and has rewritten everything using namespace ensembles, breaking AH's code to trace connect attempts.

Very annoyed, AH starts up his Perl installation he had still lying around to see how that worked again.

posted to comp.lang.tcl 2006/10/26 by Mark Janssen [L1 ]