Chained comparison
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 160
- Forks
- 59
- Avg merge
- 21h 45m
- Merged PRs (30d)
- 26
Description
What does this Stan code do?
if (x < y < z) {
The natural (naïve?) reading is that the condition asks if x < y and y < z and that is indeed how Python or Julia would interpret it. (R considers it a syntax error.)
But Stan follows C/C++ convention where it reads (x < y) < z which is either 1 < z or 0 < z depending on whether or not x is less than y.
I think this should at least raise warning but preferably Stan could just implement comparison operators the same way Python and Julia do.
Contributor guide
No contributing guide indexed for this repository
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
The issue names no files or tests; start by locating how the Stan parser and compiler handle chained comparison expressions. Determine whether the project should warn about C-style evaluation or implement chained comparisons, then add coverage that demonstrates the chosen behavior and confirms the warning or semantics.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100