Re: [Rd] Check for protection

2025-04-11 Thread Tomas Kalibera
On 4/11/25 17:39, Duncan Murdoch wrote: On a tangent from the main topic of this thread:  sometimes (especially to non-experts) it's not obvious whether a variable is protected or not. I don't think there's any easy way to determine that, but perhaps there should be.  Would it be possible to

Re: [Rd] Check for protection

2025-04-11 Thread Duncan Murdoch
That might help, but protecting things is a fairly cheap operation, so I don't know if people would bother with the naming convention. It's just as easy to just protect things if you're not sure. One way things can go wrong is when you think you protected something, but then the pointer chang

Re: [Rd] table() and as.character() performance for logical values

2025-04-11 Thread Tomas Kalibera
On 4/11/25 16:23, Suharto Anggono Suharto Anggono via R-devel wrote: Alternative revision: Added to my changed 'StringFromLogical': #define CACHE 16 if (!(*warn & CACHE)) {TrueCh = FalseCh = NULL; *warn |= CACHE;} No change to 'coerceToString' and 'coerceToSymbol'. -- On Friday

Re: [Rd] Check for protection (was: table() and as.character() performance for logical values)

2025-04-11 Thread Paul McQuesten
For a long-term horizon, would it help R developers to use a naming convention? Perhaps, varName_PROT, or the inverse varName_UNPROT? Eventually, teach some linter about that? On Fri, Apr 11, 2025 at 10:40 AM Duncan Murdoch wrote: > On a tangent from the main topic of this thread: sometimes (es

[Rd] Check for protection (was: table() and as.character() performance for logical values)

2025-04-11 Thread Duncan Murdoch
On a tangent from the main topic of this thread: sometimes (especially to non-experts) it's not obvious whether a variable is protected or not. I don't think there's any easy way to determine that, but perhaps there should be. Would it be possible to add a run-time test you could call in C c

Re: [Rd] table() and as.character() performance for logical values

2025-04-11 Thread Suharto Anggono Suharto Anggono via R-devel
Alternative revision: Added to my changed 'StringFromLogical': #define CACHE 16 if (!(*warn & CACHE)) {TrueCh = FalseCh = NULL; *warn |= CACHE;} No change to 'coerceToString' and 'coerceToSymbol'. -- On Friday, 11 April 2025 at 08:02:58 pm GMT+7, Suharto Anggono Suharto Anggono wr

Re: [Rd] table() and as.character() performance for logical values

2025-04-11 Thread Suharto Anggono Suharto Anggono via R-devel
Oh, with the abuse of 'warn' in my previous message, warning would be issued if the input 'v' of 'coerceToString' is a logical vector of length 1. Revision: Added to my changed 'StringFromLogical': if (*warn) {TrueCh = FalseCh = NULL; *warn = 0;} 'coerceToString': insert if (i == 0) warn = 1;

Re: [Rd] table() and as.character() performance for logical values

2025-04-11 Thread Suharto Anggono Suharto Anggono via R-devel
On second thought, I wonder if the caching in my changed 'StringFromLogical' in my previous message is safe. While 'ans' in the C function 'coerceToString' is protected, its element is also protected. If the object corresponding to 'ans' is then no longer protected, is it possible for the cache

[Rd] R 4.5.0 is released

2025-04-11 Thread peter dalgaard
The build system rolled up R-4.5.0.tar.gz and .xz (codename "How About a Twenty-Six") this morning. This is a major release with a number of new features, API changes, and bug fixes. The list below details the changes in this release. You can get the source code from https://cran.r-project.o