[R-pkg-devel] "Writing R Extensions" manual needs update [was: Error handling in C code]

Agner Fog @gner @end|ng |rom @gner@org
Wed Jun 26 09:41:00 CEST 2024


Thank you, but I still think the Writing R Extensions manual needs to be 
updated. The manual lists a large number of remapped function names. 
These names cannot be used in any package in the current R version 
(4.4.1) because R_NO_REMAP is defined in the Debian build script 
(intentionally or not?).

- Agner


On 25/06/2024 14.57, Tomas Kalibera wrote:
>
> On 6/24/24 09:45, Agner Fog wrote:
>> On 24/06/2024 08.56, Tomas Kalibera wrote:
>>>
>>> In principle it is the NEWS file that gives hints about important 
>>> changes and then one can find the details in Writing R Extensions.  
>>> The NEWS file as of mid-April says that "R CMD check --as-cran" will 
>>> compile C++ code with -DR_NO_REMAP. And then in Writing R 
>>> Extensions, one can read about what is R_NO_REMAP and that this has 
>>> been planned to become the default in the future. It is an important 
>>> thing to do for the maintainability of the package space: the 
>>> situation with name clashes with system headers (typically appearing 
>>> just on some platforms) has only been getting worse.
>>>
>> Thanks, but I couldn't find it when I searched for help, and I still 
>> can't find the news you are mentioning. The "Writing R Extensions" 
>> guide does not list the required Rf_ function names. This manual 
>> definitely has to be changed.
>
> The NEWS file is part of the source tree, e.g. 
> https://svn.r-project.org/R/trunk/doc/NEWS.Rd
>
> You can find a rendered version here:
>
> https://cran.r-project.org/doc/manuals/r-release/NEWS.html
> https://cran.r-project.org/doc/manuals/r-devel/NEWS.html
>
>>
>> I predict chaos when you add R_NO_REMAP to the Windows compilation: A 
>> large number of old packages containing C++ code will fail. Mails 
>> will be sent to the maintainers. Some maintainers will be 
>> uncontactable. Some packages are maintained by somebody less 
>> competent than the original programmers. Some maintainers will be too 
>> busy to react, or they have forgotten how to submit a package. You 
>> will be bombarded with help requests. In the end, somebody will have 
>> to help update the packages when the maintainers fail to do so.
>
> I am not the one working specifically on these changes, so I don't 
> have the exact details, but in principle, what you describe is daily 
> business of maintaining R and CRAN. All of what you describe has been 
> considered and changes like this are carefully tuned and planned based 
> on actually running checks of all CRAN packages on patched versions of 
> R-devel, usually outside the master repository. There is a lot of 
> effort behind such changes that may not be immediately visible.
>
>>
>> This mess is a consequence of a bad decision many years ago when 
>> somebody used non-unique function names like "error" and "warning". 
>> But the world looked very different back then, and now we are facing 
>> the consequences.
>>
>> It would be useful to do a test to see how many packages need to be 
>> changed.
>
> As above, this is something being done routinely. And it is a moving 
> target, too, in this case, as many packages run into naming conflicts 
> and are being fixed. Often the package authors receive patches or 
> hints how to fix from R Core or the CRAN team.
>
> Tomas
>>
>> - Agner
>>



More information about the R-package-devel mailing list