From Kurt.Hornik@ci.tuwien.ac.at  Wed Aug  9 19:20:07 2000
From: Kurt.Hornik@ci.tuwien.ac.at (Kurt Hornik)
Date: Wed, 9 Aug 2000 20:20:07 +0200 (CEST)
Subject: [Rd] GenGC changes
Message-ID: <14737.41175.808404.687281@aragorn.ci.tuwien.ac.at>

As most R developers maybe are already aware of, R version 1.2.0
introduced a new `generational' garbage collector which means that
strings and vectors (and language objects) are handled differently from
the numerical atomic types.

>From ``Writing R Extensions'':

       Earlier code was written in a style like.
           VECTOR(dimnames)[0] = getAttrib(x, R_NamesSymbol);
    
    but that is no longer allowed.  The functions `VECTOR_ELT' and
    `SET_VECTOR_ELT' must now be used to access and set elements of a
    generic vector.  There are analogous functions `STRING_ELT' and
    `SET_STRING_ELT' for character vectors.
    
       To convert existing code, use the following replacements.
    
         original                 replacement
         `foo = VECTOR(bar)[i]'   `foo = VECTOR_ELT(bar, i)'
         `VECTOR(foo)[j] = bar'   `SET_VECTOR_ELT(foo, j, bar)'
         `foo = STRING(bar)[i]'   `foo = STRING_ELT(bar, i)'
         `STRING(foo)[j] = bar'   `SET_STRING_ELT(foo, j, bar)'

The changes were committed to the r-devel true this Monday, and imply
that add-on packages using the original coding style will no longer work
with current versions of r-devel.  One possible solution for having
packages with sources which work for compilation under both 1.1 and 1.2
is to use conditionals of the form

    #if R_VERSION >= R_Version(1, 2, 0)
	new-style-code
    #else
	old-style-code
    #endif

I would like to ask add-on package maintainers of packages which are
affected by the change to produce updated versions of their packages
which work under both 1.1 and 1.2.  It seems that the following ones
require action:

	Java
	Matrix
	RMySQL
	RODBC
	foreign
	hdf5
	netCDF
	stataread

(Note that [currently], there is binary incompatibility between 1.1 and
1.2.)

-k

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] GenGC changes
Kurt Hornik