[Rd] Tcltk changes in R 1.8.0

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Aug 24 22:32:35 MEST 2003

I have committed a set of changes to the tcltk package for R-1.8.0.
The most important changes are

1) Support for Tcl arrays, which should come in handy for people
   playing with things like the tkTable extension. Basically these
   work like tclVar objects but can be subscripted (notice that these
   beasts are associative - like a Perl hash - rather than objects of
   set dimensions). Basic usage goes like this:

> x <- tclArray() # create array object
> x[[2]]<-123
> x[[2]]
<Tcl> 123
> x[["2"]] # the index is really a string
<Tcl> 123

> x[[1,2]]<-"abc"
> x[["1,2"]] # multiple indices are pasted together
<Tcl> abc
> x[[1,2]]
<Tcl> abc

> x[["a"]] <- pi
> x$a # usual list notation works too
<Tcl> 3.14159265359

2) A new set of routines, .Tcl.objv and .Tcl.args.objv work together
   to allow calls to Tcl to be done without first constructing a Tcl
   command in its string representation form. This creates a
   substantial efficiency gain, by elimiting a large amount of
   "quoting hell", and also by pushing some operations to C code. The
   basic tkcmd() function (which underlies almost everything else) has
   been changed to used those two functions. This should be mostly
   transparent to existing code, but it may break code that uses some
   (little advertised) features of the old interface. Apart from overt
   bugs, the only source of breakage that I am aware of is that a
   vector of length > 1 used to be converted to multiple arguments;
   now it becomes a single Tcl list object. The feature allowed you to
   do things like tkinsert(mylistbox, "end", vector.of.entries), but
   it got in the way in other contexts and overall I think it was a

Please try this out on your favourite tcltk codes and tell me ASAP if
anything breaks. Also, please tell me if there are still things that
you cannot do cleanly (i.e. without paste()-ing things together to
form .Tcl calls).

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-devel mailing list