-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Assuming we had something like:
proc foo(x: int, y: NumericVector[float]) {.exportR.} =
...the exportR pragma should make sure that the procedure is wrapped into another Nim procedure:
proc fooImpl(xImpl, yImpl: SEXP)
let x = xImpl.to(int)
let y = yImpl.to(NumericVector[float])
# ... original bodythis way we can have native Nim types as arguments and let the user avoid doing the conversions, somewhat similar to Rcpp.
For scalar types copying the data is fine. For other types (e.g. vectors etc.) we want Nim wrapper types e.g. NumericVector[T], which keeps track internally of the underlying SEXP data. This is similar to what Rcpp does as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels