
Le 26 mars 2014 à 18:03, Gabriel Becker <gmbecker@ucdavis.edu> a écrit :

> On Wed, Mar 26, 2014 at 9:50 AM, Dirk Eddelbuettel <edd@debian.org> wrote:
> 
> On 26 March 2014 at 17:22, Romain François wrote:
> | I’d like to compare two strings internally the way R would, so I need Scollate which is not part of the authorized R api.
> |
> | So:
> |  - Can Scollate (and perhaps Seql) be promoted to api ?
> |  - If not what are the alternatives ? Using strcmp or stroll does not seem as general as Scollate.
> 
> I'd add a third option:
> 
>    - Put this in a new package and register the functions you want.
> 
> That would not achieve what Romain wants. Or rather, it would when he did it, but would not be guaranteed to do so at any point after the next release of R.

That’s one part of the problem. Indeed I’d rather use something rather than copy and paste it and run the risk of being outdated. The answer to that is testing though. I can develop a test suite that can let me know I’m out of date and I need to copy and paste some new code, etc … Done that before, this is tedious, but so what. 

The other part of the problem (the real part of the problem actually) is that, at least when R is built with ICU support, Scollate will depend on a the collator pointer in util.c
https://github.com/wch/r-source/blob/trunk/src/main/util.c#L1777

And this can be controlled by the base::icuSetCollate function. Of course the collator pointer is not public.

So in short that does not help. 

> My understanding of his request is that he wants something that will "behave as R will", not "behave as R does now".
> 
> All that having been said, not every single thing R does internally can be public and of course I'm not privy or a party to discussions on what should and shouldn't be. But freezing and duplicating small pieces of R's non-exported internal code seems like a dangerous move to me. 
> 
> ~G
> 
> -- 
> Gabriel Becker
> Graduate Student
> Statistics Department
> University of California, Davis


	[[alternative HTML version deleted]]

