Skip to content

gracefully trap incorrect returnType in nCompile #107

@paciorek

Description

@paciorek

We currently get C++ compilation errors when the type of return does not match returnType. E.g.,

foo = nFunction(
              fun = function() {
                  y <- rnorm(4)
                  return(y)
              }, returnType = 'integerVector')
cfoo <- nCompile(foo)

I am not printing the error message on account of length, but it occurs with the Eigen code.

This also occurs in a way that will particularly confuse users in cases where they will probably expect integer type:

foo = nFunction(
              fun = function() {
                  y <- 1:3
                  return(y)
              }, returnType = 'numericVector')
cfoo <- nCompile(foo)

The above is fine, but if returnType = 'integerVector' (as an R user would generally do), then one gets the C++ compilation error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions