Skip to content

Commit

Permalink
(lang/R-cpp11) Updated 0.4.7 to 0.5.0
Browse files Browse the repository at this point in the history
# cpp11 0.5.0

## R non-API related changes

* Removed usage of the following R non-API functions:

  * `SETLENGTH()`

  * `SET_TRUELENGTH()`

  * `SET_GROWABLE_BIT()`

  These functions were used as part of the efficient growable vectors that
  cpp11 offered, i.e. what happens under the hood when you use `push_back()`.
  The removal of these non-API functions means that cpp11 writable vectors that
  have been pushed to with `push_back()` will likely force 1 extra allocation
  when the conversion from `cpp11::writable::r_vector<T>` to `SEXP` occurs
  (typically when you return a result back to R). This does not affect the
  performance of `push_back()` itself, and in general these growable vectors
  are still quite efficient (#362).

* The `environment` class no longer uses the non-API function
  `Rf_findVarInFrame3()` (#367).

  * The `exists()` method now uses the new `R_existsVarInFrame()` function.

  * The `SEXP` conversion operator now uses the new `R_getVar()` function. Note
    that this is stricter than `Rf_findVarInFrame3()` in 3 ways. The object
    must exist in the environment (i.e. `R_UnboundValue` is no longer returned),
    the object cannot be `R_MissingArg`, and if the object was a promise, that
    promise is now evaluated. We have backported this new strictness to older
    versions of R as well.

## New features

* `cpp11::writable::r_vector<T>::proxy` now implements copy assignment.
  Practically this means that `x[i] = y[i]` now works when both `x` and `y`
  are writable vectors (#300, #339).

* New `writable::data_frame` constructor that also takes the number of rows as
  input. This accounts for the edge case where the input list has 0 columns but
  you'd still like to specify a known number of rows (#272).

* `std::max_element()` can now be used with writable vectors (#334).

* Read only `r_vector`s now have a move constructor and move assignment
  operator (#365).

## Improvements and fixes

* Repeated assignment to a `cpp11::writable::strings` vector through either
  `x[i] = elt` or `x.push_back(elt)` is now more performant, at the tradeoff
  of slightly less safety (as long as `elt` is actually a `CHARSXP` and `i` is
  within bounds, there is no chance of failure, which are the same kind of
  invariants placed on the other vector types) (#378).

* Constructors for writable vectors from `initializer_list<named_arg>` now
  check that `named_arg` contains a length 1 object of the correct type, and
  throws either a `cpp11::type_error` or `std::length_error` if that is not the
  case (#382).

* `cpp11::package` now errors if given a package name that hasn't been loaded
  yet. Previously it would cause R to hang indefinitely (#317).

* `cpp11::function` now protects its underlying function, for maximum safety
  (#294).

* `cpp11::writable::r_vector<T>::iterator` no longer implicitly deletes its
  copy assignment operator (#360).

* Added the missing implementation for `x.at("name")` for read only vectors
  (#370).

* Fixed an issue with the `writable::matrix` copy constructor where the
  underlying SEXP should have been copied but was not. It is now consistent with
  the behavior of the equivalent `writable::r_vector` copy constructor.

* Fixed a memory leak with the `cpp11::writable::r_vector` move assignment
  operator (#338).

* Fixed an issue where writable vectors were being protected twice (#365).

* The approach for the protection list managed by cpp11 has been tweaked
  slightly. In 0.4.6, we changed to an approach that creates one protection list
  per compilation unit, but we now believe we've found an approach that is
  guaranteed by the C++ standard to create one protection list per package,
  which makes slightly more sense and still has all the benefits of the reduced
  maintanence burden mentioned in the 0.4.6 news bullet (#364).

  A side effect of this new approach is that the `preserved` object exposed
  through `protect.hpp` no longer exists. We don't believe that anyone was using
  this. This also means you should no longer see "unused variable" warnings
  about `preserved` (#249).

## Breaking changes

* R >=3.6.0 is now required. This is in line with (and even goes beyond) the
  tidyverse standard of supporting the previous 5 minor releases of R.

* Implicit conversion from `sexp` to `bool`, `size_t`, and `double` has been
  marked as deprecated and will be removed in the next version of cpp11. The 3
  packages that were using this have been notified and sent PRs. The recommended
  approach is to instead use `cpp11::as_cpp<T>`, which performs type and length
  checking, making it much safer to use.

* Dropped support for gcc 4.8, mainly an issue for extremely old CentOS 7
  systems which used that as their default compiler. As of June 2024, CentOS 7
  is past its vendor end of support date and therefore also out of scope for
  Posit at this time (#359).
  • Loading branch information
mef committed Nov 3, 2024
1 parent 7ae7757 commit cd79638
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lang/R-cpp11/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.6 2024/01/20 10:22:46 mef Exp $
# $NetBSD: Makefile,v 1.7 2024/11/03 12:19:20 mef Exp $

R_PKGNAME= cpp11
R_PKGVER= 0.4.7
R_PKGVER= 0.5.0
CATEGORIES= lang

MAINTAINER= pkgsrc-users@NetBSD.org
Expand Down
8 changes: 4 additions & 4 deletions lang/R-cpp11/distinfo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$NetBSD: distinfo,v 1.8 2024/01/20 10:22:46 mef Exp $
$NetBSD: distinfo,v 1.9 2024/11/03 12:19:20 mef Exp $

BLAKE2s (R/cpp11_0.4.7.tar.gz) = 9d7ec7dedc3591d0537b9435b62048b225d80ea2152ce1342ccd54a482e9ba4e
SHA512 (R/cpp11_0.4.7.tar.gz) = d820cbd5c72860ddec5d21134d4ce278c670d7fb57add8b126ddd952c6da1cd165df57a769a5bea63b3c55d74fe638604c5d60b0c9eb23c35bbb64b933e80182
Size (R/cpp11_0.4.7.tar.gz) = 285779 bytes
BLAKE2s (R/cpp11_0.5.0.tar.gz) = 3ef7e9a9b39f34810c909190b3ad6b566b3050955c9f0b469558e7ed34e15453
SHA512 (R/cpp11_0.5.0.tar.gz) = aa27ce7ebd6b1bd79354baf99694537236d709152c612baf619af0b2e39fa6cd61a1ea169970c13acfdbc2070821465d350694065c02bba777994d4801ce5b5e
Size (R/cpp11_0.5.0.tar.gz) = 275693 bytes

0 comments on commit cd79638

Please sign in to comment.