Message-ID: <alpine.OSX.2.21.1907301131200.1224@macbook-air-3.local>
Date: 2019-07-30T16:41:42Z
From: Luke Tierney
Subject: [External] Questions regarding ALTREP_SET_ELT APIs
In-Reply-To: <CAGiFhPN6JY-CRO=kAexUgg38rh5yV_PbccFU7k2Eow5RSWnt2g@mail.gmail.com>
On Tue, 30 Jul 2019, Wang Jiefei wrote:
> Hi all,
>
> I'm wondering if there is any way to define a `SET_ELT` function for an
> ALTREP class? I see there are ` ALTINTEGER_SET_ELT` etc. functions exported
> in Rinternal.h, but there is no corresponding ALTREP APIs to define them.
> The only way to set the value of an ALTREP is through a pointer, which will
> require that the ALTREP data is in memory. Is it on purpose?
For now, yes. We do support a Set_elt method for ALTSTRING classes but
not yet for others. I seem to recall that there are some issues with
going there for others, but we'll probably take a closer look later
this year.
One thing to keep in mind is that the R pass-by-value semantics
require that C code duplicate an object for which MAYBE_REFERENCED is
true, and the assumption in existing code is that duplicate returns an
object that can safely be mutated. That places a lot of limitations on
what can be done. You can see some notes on the issues in the
README.md and the vignette in
https://github.com/ALTREP-examples/Rpkg-mutable.
Best,
luke
> Will there be
> any plan to develop these ALTREP set element APIs?
>
> Best,
> Jiefei
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa Phone: 319-335-3386
Department of Statistics and Fax: 319-335-3017
Actuarial Science
241 Schaeffer Hall email: luke-tierney at uiowa.edu
Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu