Re: Tcl-URL! - weekly Tcl news and links (Jun 12)

That's really interesting. In all my years of doing Tk, I don't think I've ever wished for that feature. I'm not saying the TIP is good or bad, I'm just making an observation.

Well, I've been longing for such a feature a long time, otherwise I wouldn't have submitted the TIP :-)

I find it really annoying to have to define a name for a widget, when that name is in fact irrelevant (i.e. not used in the rest of the code). A widget is usually assigned to a variable, and only referred to by that variable. The variable often gets the same name as the widget, sometimes a slightly different name, sometimes a completely different one. This certainly doesn't improve the readability (and writability) of the code.

When the name of the variable is changed for some reason, you have the option of also changing the name of the widget, or leaving it as it is, increasing potential confusion.

I've in fact been using the patch in the TIP for about half a year now, and I wouldn't want to go back. Of course, I can only speak for myself here, but my personal observation is that I use the auto-naming feature for about 90% of the widgets.

I can see how it would be handy, though the TIP says it won't guarantee a unique name which seems very odd ("Note that there is no protection against already existing window names"). I would think it best if it worked like automatic image names where the system always picks a new, unique name.

It guarantees a unique name as long as you don't intermix "normal" and "automatic" names. Numbers are not normally used as widget names, so I don't see a problem here. If you really want to use numbers for normal names, you can still use a prefix for the automatic names:

frame .1
frame .2
frame ._%

(Of course, if really needed, the implementation could change on this point.)