In article <42eb6a1c$0$1154$5402220f@news.sunrise.ch>,
simonbachmann at bluewin dot ch <"simonbachmann at bluewin dot ch"> wrote:
>
>
>Larry W. Virden a écrit:
>> Re: "read in" changes to the script
>>
>> Sure - all you need
>>
>> $ tclsh
>> % proc abc {} {
>> puts abc
>> }
>> % abc
>> 123
>> % proc abc {} {
>> puts 123
>> }
>> % abc
>> 123
>> %
>>
>
>OK, but what if my script is in a file? source the file(s) again doesn't
>work if the script contains commands that create widgets. In other
>words, if in your example the proc 'abc' would contain as an example the
>command 'button .b -text "Hello"', and then change the command to
>'button .b -text "Bye"' re-executing the proc, would give an error: "a
>window named .b already exists".
>
>
Michael and Schelte followed up with two distinct answers. I'd
emphasize that there are several (more) ways to respond. First,
there's non non-parodoxical way to interpret your requirements;
while I don't provide a proof in this message, I assure you it's
true. You have to refine and particularize your needs a bit
more (for this problem), before they can be met.
So, no, Tcl does *not* provide a general-purpose start-all-over-
again command, because such a thing is too ill-defined. Many of
us who work with the language daily have our own brief idioms for
achieving what *we* want in that direction, as previous follow-
ups have explained. My own practice is to make my [sourc]ables
idempotent by, for example, [destroy]ing widgets before they're
created (as has already been mentioned), or, sometimes, re-using
existing widget instance.
Received on Thu Sep 29 14:28:08 2005