Re: [Rd] Clearing attributes returns ALTREP, serialize still saves them

2021-07-02 Thread Gabriel Becker
Ok, a bit more: The relevant bit in serialize.c that I can see is: if (ALTREP(s) && stream->version >= 3) { SEXP info = ALTREP_SERIALIZED_CLASS(s); SEXP state = ALTREP_SERIALIZED_STATE(s); if (info != NULL && state != NULL) { int flags = PackFlags(ALTREP_SXP, LEVELS(s), OBJECT(s), 0, 0);

Re: [Rd] Clearing attributes returns ALTREP, serialize still saves them

2021-07-02 Thread Gabriel Becker
Hi all, I don't have a solution yet, but a bit more here: > .Internal(inspect(x2b)) @7f913826d590 14 REALSXP g0c0 [REF(1)] wrapper [srt=-2147483648,no_na=0] @7f9137500320 14 REALSXP g0c7 [REF(2),ATT] (len=100, tl=0) 0.45384,0.926371,0.838637,-1.71485,-0.719073,... ATTRIB: @7f913826dc

[Rd] Clearing attributes returns ALTREP, serialize still saves them

2021-07-02 Thread Zafer Barutcuoglu
Hi all, Setting names/dimnames on vectors/matrices of length>=64 returns an ALTREP wrapper which internally still contains the names/dimnames, and calling base::serialize on the result writes them out. They are unserialized in the same way, with the names/dimnames hidden in the ALTREP wrapper,

Re: [Rd] [External] SET_COMPLEX_ELT and SET_RAW_ELT missing from Rinternals.h

2021-07-02 Thread luke-tierney
On Thu, 1 Jul 2021, Konrad Siek wrote: Thanks! So what would be the prescribed way of assigning elements to a CPLXSXP if I needed to? The first question is whether you need to do this. Or, more to the point, whether it is safe to do this. In R objects should behave as if they are not mutable.