My question is i have created two versions that is 1.1 1.2 packages i have same procedures in 1.1 and 1.2 but i modified a new version of procedure in 1.2.
Now my question is suppose to want acess old version (1.1) procedure. How i do?
My question is i have created two versions that is 1.1 1.2 packages i have same procedures in 1.1 and 1.2 but i modified a new version of procedure in 1.2.
Now my question is suppose to want acess old version (1.1) procedure. How i do?
Use the -exact flag in the package require statement:
package require -exact mypackage 1.1
UPDATE: I don't recommend having different versions of the same package loaded one after another. However, you can load the first version, do your business, unload it, then load the second version and do your business. In code:
package require -exact mypackage 1.1
mySquare 2
package forget mypackage
package require -exact mypackage 1.2
mySquare 3
but it uses only package 1.1, but i want use both 1.1 and 1.2, when i am use both package 1.1 and 1.2 it display conflict both 1.1 and 1.2, i use like this
package require myFunctions 1.1 puts [mySquare {2}]
package require -exact myFunctions 1.2 puts [mySquare {3}]
it gives the error
conflict between version 1.1 and 1.2
Each interpreter can only load a single version of any particular package; it's assumed that their namespaces clash so that it isn't possible to load two versions of the same thing at once.
However, you might be able to load the other version (using the -exact
option to force the less-recent version) in a sub-interpreter. This is more likely to work with pure scripted packages than those which have a C component (that depends on the OS's dynamic library loader being happy with these things; some are, some aren't.)
interp create subinterp
subinterp eval {
package require -exact mypackage 1.1
}
subinterp eval mySquare 3
This might or might not be what you're after though; interpreters are very strongly isolated from each other, so access to other things going on in the master interpreter would require setting up aliases…
thanks it is working perfectly, but when i am doing again
can't find package myFunctions exactly 1.2 while executing "package require -exact myFunctions 1.2" (file "square.tcl" line 2)
i getting this error, and i checked pkgIndex.tcl file it displays only
package ifneeded myFunctions 1.1 [list source [file join $dir myFunctions.tcl]]
only ver 1.1 but it deletes the 1.2 when i am doing like this.