All commands are equal, but some are more equal than others.
- From: "Mark Janssen" <mpc.janssen@xxxxxxxxx>
- Date: 25 Oct 2006 17:41:08 -0700
<In very poor Mark Roseman style>
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.
<PHB> AH we are having some problems with connections being dropped.
Can you do some debugging?
<AH> 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.
<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.
----
In the story above I have tried to demonstrate what my worries are
about some of the currently evolving functionality that is being put
into Tcl.
Up until now a command was just a command. Some commands you could see
the args and body of (defined with proc) and some not (internal
commands).
However in Tcl 8.5 there seem to be some commands that are more command
than the old fashioned Tcl commands. These commands (objects and
namespace ensembles) offer exciting new introspection capabilities
(such as finding out the defined subcommands). However because they
have overlapping functionality some choose one way and others choose
another.
I can see several problems with this:
1) Tcl user experience: you will have to know what type of command a
command is and use the appropriate way to extend it. TIMTOWTDI
2) Package maintainers/developers. Even though TIMTOWTDI, once you have
chosen one way you cannot change because your users are probably using
implementation details (is it OO, is it namespace)
My question is, are there any plans to:
1) Migrate all internal commands accepting subcommands to one of the
two scheme's (string chan etc.) to make the user experience more
uniform. (If it looks the same, it acts the same)
2) Is there any pressing reason for the seemingly overlap in OO and
namespace ensembles and is it a good idea to introduce this in the
first place?
I understand that 1 is a Herculean task, I am just wondering if it is
being considered.
Mark
.
- Follow-Ups:
- Re: All commands are equal, but some are more equal than others.
- From: Larry W. Virden
- Re: All commands are equal, but some are more equal than others.
- From: Don Porter
- Re: All commands are equal, but some are more equal than others.
- From: Donal K. Fellows
- Re: All commands are equal, but some are more equal than others.
- Prev by Date: help selecting from a numbered list
- Next by Date: Re: Help regarding vfs
- Previous by thread: help selecting from a numbered list
- Next by thread: Re: All commands are equal, but some are more equal than others.
- Index(es):
Relevant Pages
|