Re: Tcl (Itcl) and default parameters/arguments
- From: "Bob Techentin" <techentin.robert@xxxxxxxx>
- Date: Mon, 29 Aug 2005 16:34:59 -0500
"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
}
}
Bob
--
Bob Techentin techentin.robert@xxxxxxxxxxxxxx
Mayo Foundation (507) 538-5495
200 First St. SW FAX (507) 284-9171
Rochester MN, 55901 USA http://www.mayo.edu/sppdg/
.
- Follow-Ups:
- Re: Tcl (Itcl) and default parameters/arguments
- From: Don Porter
- Re: Tcl (Itcl) and default parameters/arguments
- From: MH
- Re: Tcl (Itcl) and default parameters/arguments
- References:
- Prev by Date: .text search unexpected match
- Next by Date: Re: Rename folders
- Previous by thread: Tcl (Itcl) and default parameters/arguments
- Next by thread: Re: Tcl (Itcl) and default parameters/arguments
- Index(es):
Relevant Pages
|