Re: Tcl (Itcl) and default parameters/arguments



In article <devv1t$f52$1@xxxxxxxxxxxxxxxx>,
Bob Techentin <techentin.robert@xxxxxxxx> wrote:
>"MH" <mghembru@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote
>> Hi. I'm working in Itcl, and I'm wondering if this is possible:
>>
>> itcl::class x {
>> public variable y;
>>
>> public method a { {p1 $y} } {
>> puts "Value is: $p1"
>> }
>> }
>
>
>I don't think that it is possible.
>
>But you can work around it. Use {args}, count the parameters, and do things
>the hard way. A little easier, but not quite as robust, is something like:
>
> public method a { {p1 VERY_UNLIKELY_DEFAULT} } {
> if { $p1 eq VERY_UNLIKELY_DEFAULT } {
> set p1 $y
> }
> }

Yup, I know how to work around it - just didn't want to if I didn't have to
:-)

Thanks.

Mattias
.