Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Chained comparison doesn't work with in binary operator #5434

Open
STRd6 opened this issue Nov 6, 2022 · 1 comment
Open

Bug: Chained comparison doesn't work with in binary operator #5434

STRd6 opened this issue Nov 6, 2022 · 1 comment

Comments

@STRd6
Copy link
Contributor

STRd6 commented Nov 6, 2022

in is a relational operator and should work with chained comparisons.

Input Code

a in b in d

Expected Behavior

var ref,
  indexOf = [].indexOf;

indexOf.call(b, a) >= 0 && indexOf.call(d, b) >= 0;

Current Behavior

var ref,
  indexOf = [].indexOf;

ref = indexOf.call(b, a) >= 0, indexOf.call(d, ref) >= 0;

Python Behavior

daniel@DESKTOP-HATA8GU:~/apps/civet$ python3
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 1
>>> b = [1]
>>> a in b
True
>>> c = [b]
>>> b in c
True
>>> a in b in c
True
>>> 
  • CoffeeScript version: 2.7.0

@GeoffreyBooth Feel encouraged to bundle up these "breaking changes" bug reports into a Coffee3 tag/milestone... a man can dream 🌟

@GeoffreyBooth
Copy link
Collaborator

Feel encouraged to bundle up these “breaking changes” bug reports into a Coffee3 tag/milestone… a man can dream 🌟

Based on the tempo of PRs lately I think it’s clear that the project is in maintenance mode. Unless there’s a groundswell of volunteering energy like there was for CoffeeScript 2, I don’t see a CoffeeScript 3 anytime soon (if ever).

That said, bugs are bugs, and fixing them shouldn’t be considered breaking changes as long as the “fix” isn’t drastic (like it shouldn’t break CoffeeScript’s own codebase, at minimum). But I’m skeptical of bugfixes for the sake of lexical consistency. CoffeeScript is a real language used by real people on real projects, not an academic computer science project, and some inconsistency is acceptable when the alternative is breaking people for no good reason besides “correctness.”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants