Home > Archive > Tcl > June 2007 > How to get default values to parameters of class object member methods [incr tcl]
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to get default values to parameters of class object member methods [incr tcl]
|
|
| Andrew Falanga 2007-06-29, 10:08 pm |
| Hello again,
Thanks to all for helping fix my simple blunder. Now I've got another
one and I'm not sure if there is a resolution. I've tried a few
different things, but nothing seems to be working. As well all know,
if a proc is to have a default value for a parameter, it's defined
something like this:
proc someproc { { param = foo } } {
# doing lots of important stuff
}
Well, I've tried something similar in my classes but the interpreter
is always complaining about "too many fields in argument specifier " i
= 234 "". This was with something like:
class integers {
variable int
constructor { i } {
set int $i
}
method SetInt { { i = 234 } } {
set int $i
}
}
Is it possible to have methods with default values to their parameters
in class methods?
Andy
| |
| Schelte Bron 2007-06-29, 10:08 pm |
| Andrew Falanga wrote:
> Thanks to all for helping fix my simple blunder. Now I've got
> another
> one and I'm not sure if there is a resolution. I've tried a few
> different things, but nothing seems to be working. As well all
> know, if a proc is to have a default value for a parameter, it's
> defined something like this:
>
> proc someproc { { param = foo } } {
> # doing lots of important stuff
> }
>
Something like that, but not exactly. It should be:
proc someproc { { param foo } } {
# doing lots of important stuff
}
And that will work for itcl methods as well.
Schelte.
--
set Reply-To [string map {nospam schelte} $header(From)]
| |
| Andrew Falanga 2007-06-30, 4:18 am |
| On Jun 29, 1:14 pm, Schelte Bron <nos...@wanadoo.nl> wrote:
> Andrew Falanga wrote:
>
>
> Something like that, but not exactly. It should be:
>
> proc someproc { { param foo } } {
> # doing lots of important stuff
>
> }
>
> And that will work for itcl methods as well.
>
> Schelte.
> --
> set Reply-To [string map {nospam schelte} $header(From)]
Thanks. I'm hitting my head against my desk now and thinking I should
probably log off my computer and head home for the w end while I
still have some dignity. I don't know what I was thinking when I
wrote this message. I knew that the syntax isn't:
proc someproc { { param = foo } } {
# stuff here
}
but
proc someproc { { param foo } } {
# stuff here
}
I really think I should pack it in for the w end.
Andy
|
|
|
|
|