Questions regarding ALTREP_SET_ELT APIs

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions regarding ALTREP_SET_ELT APIs

Wang Jiefei
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? Will there be
any plan to develop these ALTREP set element APIs?

Best,
Jiefei

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: [External] Questions regarding ALTREP_SET_ELT APIs

Tierney, Luke
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]]
>
> ______________________________________________
> [hidden email] 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:   [hidden email]
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: [External] Questions regarding ALTREP_SET_ELT APIs

Wang Jiefei
Hi Luke,

Thanks for your quick response. I appreciate your help.

Best,
Jiefei

On Tue, Jul 30, 2019 at 12:41 PM Tierney, Luke <[hidden email]>
wrote:

> 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]]
> >
> > ______________________________________________
> > [hidden email] 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:   [hidden email]
> Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel