Add "array[] int, int" signature to infix operators + and -
Open
Nobody has claimed this yet.
feature
good first issue
- Dominant language
- C++
- Stars
- 839
- Forks
- 220
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 14
Description
Description
When I try to add an array of integers and a single integer, I get the error:
Ill-typed arguments supplied to infix operator +. Available signatures:
...
Instead supplied arguments of incompatible type: array[] int, int.
Is there a specific reason we don't have an array[] int, int signature for + and -?
Example
The following Stan code snippet will results in an error, but would be a well defined (vectorized) opteration I believe.
data {
int N;
array[N] int J;
}
transformed data {
array[N] int K = J + N;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the transformed-data Stan example with array[N] int J, J + N, and the corresponding - operation, then trace how Stan resolves infix operator signatures. Done means both operators accept array[] int, int and the example compiles without the reported type error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100