[Rd] Forcing a PROTECT Bug to Occur

2023-04-29 Thread Michael Milton
I'm trying to learn about R's PROTECT system. To that end I've tried to create an example of C code that doesn't protect anything. I was hoping it would either segfault from trying to access deallocated memory, or maybe print out nonsense results because the unprotected memory got overwritten, but

Re: [Rd] Generalised piping into operators

2023-04-22 Thread Michael Milton
x27;t realise!): > 1 |> `+`(x=_, 2) [1] 3 On Sat, Apr 22, 2023 at 3:00 AM Duncan Murdoch wrote: > On 21/04/2023 12:16 p.m., Michael Milton wrote: > > I'm afraid I don't understand. I know that parsing `+`(1, 1) returns a > > result equivalent to `1 + 1`, bu

Re: [Rd] Generalised piping into operators

2023-04-21 Thread Michael Milton
I'm afraid I don't understand. I know that parsing `+`(1, 1) returns a result equivalent to `1 + 1`, but why does that impose a restriction on parsing the pipe operator? What is the downside of allowing arbitrary RHS functions? [[alternative HTML version deleted]]

Re: [Rd] Generalised piping into operators

2023-04-21 Thread Michael Milton
Thanks, this makes sense. Is there a similar precedence reasoning behind why operator functions (`+` etc) can't be piped into? On Fri, Apr 21, 2023 at 11:52 PM Duncan Murdoch wrote: > On 21/04/2023 4:35 a.m., Michael Milton wrote: > > I just checked out R-devel and noticed that

[Rd] Generalised piping into operators

2023-04-21 Thread Michael Milton
I just checked out R-devel and noticed that the new "pipe extractor" capability coming in 4.3 only works for the 4 extractor operators, but no other standard operators like +, *, %*% etc, meaning that e.g. mtcars |> as.matrix() |> _ + 1 |> colMeans() is a syntax error. In addition, we are still sub

Re: [Rd] Breaking Change in Rcomplex Layout?

2023-04-04 Thread Michael Milton
I don't think an auto-generated name (along the lines of u or u2) for the anonymous structs would be helpful here. You can see that bindgen is already generating a placeholder name ("__bindgen_anon_1"). A meaningful name might be nice instead, but I get the impression that isn't an option here sinc

Re: [Rd] Breaking Change in Rcomplex Layout?

2023-04-03 Thread Michael Milton
ing on the R version being used. Cheers On Tue, Apr 4, 2023 at 12:15 AM Tomas Kalibera wrote: > > On 4/3/23 15:50, Michael Milton wrote: > > Okay, but I'm afraid this will only mean something to Rust users. The > reason being that we encountered this issue in extendr:

Re: [Rd] Breaking Change in Rcomplex Layout?

2023-04-03 Thread Michael Milton
; > On 4/3/23 14:07, Michael Milton wrote: > > Hi all, > > > > There seems to have been a breaking change in the R trunk caused by a fix > > to bug 18430 <https://bugs.r-project.org/show_bug.cgi?id=18430> that > > relates to the layout of the Rcomplex typedef. Previou

[Rd] Breaking Change in Rcomplex Layout?

2023-04-03 Thread Michael Milton
Hi all, There seems to have been a breaking change in the R trunk caused by a fix to bug 18430 that relates to the layout of the Rcomplex typedef. Previously it was a struct, but now it's a union by default