Schelte Bron wrote:
> Andrew Falanga wrote:
>>>> uplevel #0 [list _source] $pathToFile
>>>This should be:
>>>
>>>uplevel 1 [list _source $pathToFile]
>>>
>>>The revised [list] arguments are in order to support values
>>>of $pathToFile that contain spaces. That's the whole point of
>>>[list] quoting. Just [list _source] alone is essentially
>>>[pointless.
>>Honestly, it seemed that way to me too. However, I was going off
>>of a thread "extend Tcl commands? no can do?" originally posted to
>>this list
>>Oct. 3, 2000 by a p_lavarre. In this thread a Dan Kuchler advised
>>the OP that his redefinition of the source command should look
>>like this:
>>
>>proc ::source {args} {
>> puts test
>> return [uplevel [list source_orig] $args]
>>}
>>
>>With the exception of the return addition, he had what I wrote.
>
> No he hadn't. There's one very significant difference: Dan used the
> special argument "args". If the last argument to a proc is called
> args, it will contain *a list of* the remaining arguments. Any
> argument named differently will only contain the value of a single
> argument. This is why your argument should be included inside the
> list statement while it shouldn't be in case of using "args".
>
> Schelte.
Thanks to all for the encouragement and thank you Schelte for clarifying
this. This I didn't readily see. It seems to me that when I first
learned TCL (about 4 years ago) I read that args was a list. However, I
rarely use it when coding and that fact went to the back spaces of the
brain.
Thanks again everyone. I really like the quality of knowledge in here,
and it's great that folks are so willing to help.
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Received on Sun Apr 30 03:11:47 2006