Skip to content

Array length/memory errors with the range operator #240

@deepilla

Description

@deepilla

The range operator doesn't do any checks on the size of the arrays that it creates. If you try to create an array larger than JavaScript can handle, e.g. [1..1e10], you get an Invalid array length error. Note that this is a JavaScript error rather than a JSONata error. Maybe JSONata could check for this case and handle it more gracefully.

Along similar lines, the array [1..1e9] is legal but my machine runs out of memory trying to evaluate it. I suspect that if memory were not an issue, the expression would still be prohibitively slow to run. Is it worth imposing an upper bound on range operator array size?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions