Closed aadler closed 1 year ago
Nice. I started that too for my packages, so far one it. I am actually torn over whether I think this is a good policy or not because there are still so many old systems (hello HPC users!) with older compilers. But of me thinks we may want to push back, part of me knows how hard it is to get change in once the wheels are in motion...
And I noticed the old .Call() pattern too. All good!
PS You want C++17 in the Subject though :wink:
Another issue is that we may not want C++17 -- we may just be better off not setting a standard. As I just wrote in RcppParallel (while Kevin independently made just that change):
One thing I have been wondering, though, is whether or not we should set a CXX_STD. "Way back when" we had to as the then-default compiler was insisting on C++98. Now we have modern C++ by default, and adding this feels like adding a constraint. Should we just leave it open? (IIRC) R 4.0.0 turned on C++11, R 4.1.0 turned to C++14, R 4.3.0 will turn on C++17. Good enough?
@eddelbuettel @astamm true, but WRE for R-devel does say "Different versions of R have used different default C++ standards, so for maximal portability a package should specify the standard it requires". Then again, it's not that C++17 is required but that C++11 is old. I think the next release of Rtools43 is also going to default to C++17 for what it is worth (See R Daily News of 2023-01-26 and 2023-01-27).
All that being said, I think leaving it out is fine so long as there are no explicit reliances on C++17 features, which I believe there are not.
That is all true but it is also true that nloptr, just like many other packages, will most likely work with C++11 and C++14 and C++17. So there is no 'require' here. I am thinking I will remove the requirement / standards setting from my packages. (This here is Aymeric's so I am just piping in from the side.)
I tested under r-devel: no setting a C++ standard does not trigger the warning one gets when picking C++11. So I think I am just going to remove it. May need to sleep over it once or twice more, and think it over. But it currently strikes me as the better approach.
I think you are correct, @eddelbuettel, since nloptr isn't relying on anything special in C++17, I removed reference to CXX from all three Makevars as discussed. The defaults are going to be 14 or 17 pretty soon anyway, so we should be good. Thanks.
Hi @astamm. SInce you haven't responded yet, I am taking the opportunity to do even more cleanup and tweaking. The commits should be self explanatory, together with the conversation with @eddelbuettel. So far, everything passes the 51 tests. However, as an old-time R curmudgeon, I do not have roxygen installed, so it would be very valuable if you would allow the workflow tests to proceed.
There are a couple of other changes I would like to make, but they would 1) be a more serious styleguide change or 2) require better testing, so I would appreciate your input.
hin <- function(x) (-1) * .hin(x)
could be replaced by hin <- function(x) -.hin(x)
but I wouldn't want to try it without a test suite.Thanks.
Thanks a lot @aadler. I agree with both of you about your earlier discussion @aadler @eddelbuettel. And I am happy with the further changes you suggest (both the aesthetics one and the efficiency one). I actually took over Jelmer for the maintenance and wanted to do some code reformatting / refactoring myself for quite some times so I am perfectly aligned with your ideas. I'll accept all the help I can get so if you find time to write up more tests, that will also be super appreciated. I'll try to invest some time into it as well in the near future.
OK. I clearly did too much in one PR. It looks like it may be due to the is.na --> anyNA, but in order to make things cleaner, I am going to close this pull request and start providing simpler ones so that this does not happen again. Is that ok with you @astamm?
Absolutely!
See the commit notes but in order of decreasing importance: