All commands are equal, but some are more equal than others.



<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

.



Relevant Pages

  • TIP #185: Null Handling
    ... nulls, and command modifications for manipulating them. ... Tcl deals with strings, the universal medium for representing data. ... is know and it is an empty string, but if a respondent forgets to give ...
    (comp.lang.tcl)
  • Re: The "never use string commands with lists" mantra - Why?
    ... The reason is because Tcl isn't like other languages. ... The fundamental role of the tcl parser is to take a string (eg: ... Tcl has no idea what the command will do ... when lists truly were strings. ...
    (comp.lang.tcl)
  • Re: TCL source code
    ... learning Tcl, and I am not a professional programmer. ... Tcl is a command line interface. ... you, Tcl is passing the name which is a string, but this string, this ... A script is a sequence of commands Tcl execute them one after the other ...
    (comp.lang.tcl)
  • Re: A different design for closures
    ... > stored such that it's part of the command data. ... > it's string rep/value makes sense to me. ... The Tcl programmer ... puts "scope = $scope" ...
    (comp.lang.tcl)
  • Re: URL2PDF()
    ... Ok, it can be done with low level http functions,....Of course there will be ... *** Maximum String size for the wwResponseString class ... DEFINE CLASS wwHTTP AS Custom ... DECLARE INTEGER InternetCloseHandle; ...
    (microsoft.public.fox.vfp.reports.printing)