TclOO : Rename method

Viewed 78

I would like to rename a method foo to Foo but keep the old method (foo) to avoid renaming all methods already used.
I think that configuring my object with this function renamemethod fromName toName is not the solution in my case since this solution will remove my old method.
I wanted to do that, but I’m asking if that’s correct :

method foo {args} {
    # do something... with $args
}

method Foo {args} {
    # The first letter in capital letter...
    my foo $args
}

export Foo

I don’t think it’s pretty, but I don’t know how else to do it.

1 Answers

You can use the forward command:

forward Foo my foo

Do you think that is prettier?

Related