Thank you Martin - I've been following your commits to R-devel and
R-beta. FWIW, I've just verified that it works as expected - I scanned
the base environment for all primitive functions and then verified
that attr(x, "abc") <- TRUE gives an error on R-devel;

$ R --vanilla
R Under development (unstable) (2025-04-02 r88098) -- "Unsuffered Consequences"
> attr(sum, "abc") <- TRUE
Error in attr(sum, "abc") <- TRUE : cannot set attribute on a 'builtin'

a warning on R-beta;

$ R --vanilla
> R version 4.5.0 beta (2025-04-02 r88102) -- "How About a Twenty-Six"
> attr(sum, "abc") <- TRUE
Warning message:
In attr(sum, "abc") <- TRUE :
  Setting attributes on primitive functions is deprecated and will be disabled

and neither on R release.

For the warning in R 4.5.0 beta, have you considered making it a
warning of class 'deprecatedWarning'? Not a big deal, but wanted to
mention it, just in case.

/Henrik

On Fri, Mar 21, 2025 at 10:07 AM Henrik Bengtsson
<henrik.bengts...@gmail.com> wrote:
>
> On Fri, Mar 21, 2025 at 8:55 AM Martin Maechler
> <maech...@stat.math.ethz.ch> wrote:
> >
> > >>>>> Martin Maechler
> > >>>>>     on Fri, 21 Mar 2025 14:49:16 +0100 writes:
> >
> > >>>>> Henrik Bengtsson
> > >>>>>     on Thu, 20 Mar 2025 11:55:05 -0700 writes:
> >
> >     >>> I'm pretty convinced we should fix it by checking for
> >     >>> primitive functions inside the C code of `attributes<-` :
> >     >>> arguably the bug is really there, rather than in
> >     >>> structure().
> >     >>>
> >     >>> Patches are welcome (via R's Bugzilla or just here).
> >
> >     >> Thank you Martin. I'll make sure I create a brief BugZilla
> >     >> report on this, and hopefully a follow with a patch later
> >     >> on.
> >
> >     >> One question on urgency or not: Is it too late to get such
> >     >> a change in for the R 4.5.0 release? I suspect so, because
> >     >> it has a potential of breaking existing packages. But if
> >     >> there's a possibility of fixing this in R 4.5.0, I'll make
> >     >> this a top priority.  Please let me know.
> >
> >     >> /Henrik
> >
> >     > In such cases, I always go to  https://developer.r-project.org/
> >     > and look at the release schedule.
> >
> >     > Important for this Q seems
> >
> >     > * Friday 2025-03-14: GRAND-FEATURE FREEZE (4.5.0 alpha)
> >     > * Friday 2025-03-28: FEATURE FREEZE (4.5.0 beta)
> >     > * Friday 2025-04-04: CODE FREEZE (4.5.0 RC)
> >
> >     > So, yes there's a possibility  ... but as you mentioned, too,
> >     > it depends quite a bit on if the fix is easily affectiong useR
> >     > and CRAN/Bioc package space.
> >
> >     > Martin
> >
> > As a matter of fact, I'm testing already a simple patch I wrote
> > myself.
> > So, sorry, but I must renounce the above  "Patches are welcome".
>
> Excellent and even better (for me). Thank you Martin!
>
> /Henrik
>
> >
> > Martin

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to