From: Donald G Porter on 15 Feb 2010 23:25 Georgios Petasis wrote: > rename ::tcl::mathfunc::int ::tcl::mathfunc::int_original > > proc ::tcl::mathfunc::int {argument} { > ## Check if argument is an object. If it is, return the proper value. > ## If it is not, just return the original behavior: > return [::tcl::mathfunc::int_original] > } Don't Do It That Way. That will redefine int(.) for all expressions. Better you redefine it only for the expressions in your code; that is in your namespace. namespace eval my { namespace eval tcl { namespace eval mathfunc { proc int {argument} { ## Check if argument is an object. ## If so, return the proper value. ## If no, return original behavior. return [::tcl::mathfunc::int $argument] } } } # Inside ::my , [expr {int(.)}] has the customization. } Leave the original alone, so that other code using it is undisturbed. DGP
|
Pages: 1 Prev: Intriguing Tk appearance under MacOS X Next: Giant Fonts on Scientific Linux |