Skip to content

Generated glue code should validate scalar #717

@szhorvat

Description

@szhorvat

Currently, the generated glue code between R and C uses a very naive method to transfer scalar values to C. Since in R all values are vectors, the code simply takes the first element of that vector.

This should be improved, and it should be checked whether the data that was passed is indeed a scalar, i.e. whether it has length 1.

  • The top priority is to ensure that the length is not zero, otherwise trying to take the first element may cause a crash, as in neighbors bug #153.
  • It would also be good to check that the length is not greater than 1, but this would be a breaking change, as some other packages may rely on the current behaviour of just taking the first element.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions