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

The right shift assignment operator shouldn't look like an arrow #1027

Closed
ogregoire opened this issue May 6, 2020 · 8 comments
Closed

The right shift assignment operator shouldn't look like an arrow #1027

ogregoire opened this issue May 6, 2020 · 8 comments
Labels

Comments

@ogregoire
Copy link

ogregoire commented May 6, 2020

In languages such as C, C++, Java and JavaScript, the right shift assignment is an operator that shifts bits to the right and assign the value to the left operand. Its representation is >>=, that is the character sequence GREATER_THAN_SIGN, GREATER_THAN_SIGN, EQUALS_SIGN.

Yet, FiraCode thinks it's an arrow and represents it as follow:

Right shift assignment with FiraCode

Would it be possible to fix the ligature so that it's closer to what it represents in those languages? I haven't done any statistical example, but I strongly believe that this sequence of characters, while uncommon, is definitely more used as an operator than as an arrow among the users of FiraCode.

More generally, the same happens for various operators which are standard across various spread programming languages: C and C++, Java and JavaScript

@ogregoire ogregoire changed the title The right shift assignment operator looks like an arrow The right shift assignment operator shouldn't look like an arrow May 6, 2020
@tonsky
Copy link
Owner

tonsky commented May 6, 2020

Thanks! I’ll look into it

@tonsky tonsky added the conflict label May 6, 2020
@ogregoire
Copy link
Author

Just for info, the languages I mentioned are just an arbitrary subset of the top most used programming languages. Other top used languages like Python, C# or Objective-C also use this kind construct. Basically, any top-10 language is impacted.

Also, other operators that are impacted by this are:

  • <<=: LOWER_THAN_SIGN, LOWER_THAN_SIGN, EQUALS_SIGN
  • |=: PIPE, EQUALS_SIGN

It is worth noting that >>>= is not impacted.

@anon476
Copy link

anon476 commented May 12, 2020

Bind is the quintessential operator of Haskell. Haskell may not be as popular as other mainstream languages, but it’s too big to just ignore an integral part of it.

Disable the ligature in a stylistic set. I quite like the design as is.

@haneefmubarak
Copy link

Let me start out by giving a shout to to @tonsky for this absolutely phenomenal font that he puts all this work into and liberally licenses to us for free. Thank you so much for all of the hard work and taking our requests into account — we all appreciate you and your work so much!


That being said, this is basically the first thing that I noticed when installing the font in my editor:

image

It yields a peculiar feel to itself that some of the compound assignment operators appear to be ligatures (/=, ^=, |=, <<=, and >>=) whereas the other operators don't appear so (+=, -=, *=, %=, &=). This doesn't practically turn out to be an issue, at least for the most part, since they still read cleanly, at least for most of them...

However, the right shift assignment operator definitely appears particularly egregious because it frankly doesn't make intuitive sense when reading that that'd be a right shift. You can at least somewhat mentally intuit the left shift assignment operator after a second, but the right shift assignment operator simply doesn't make sense intuitively.

The argument for resolving this is bolstered by the fact that 14 of the top 20 programming languages (archive.org snapshot for future readers) utilize those compound operators, the exceptions being:

  • SQL & PL/SQL don't substantially do assignment for the most part, being declarative query languages and all
  • R & MATLAB don't use compound assignment in general
  • Assembly languages don't tend to meaningfully use syntax beyond extremely basic symbols, the whole point being to use instructions and all
  • Scratch is a visual block based language and does not use text in the conventional sense

Furthermore, users of the above exceptions would not be negatively affected by the requested change.

I therefore suggest that a tenable solution could be to resolve this issue by default, with a stylistic set option (or multiple) to reenable the altered ligatures.

@haneefmubarak
Copy link

Related: #974

@tonsky
Copy link
Owner

tonsky commented May 25, 2020

@haneefmubarak thanks. I agree those arrows should go into stylistic set

@exorcist365
Copy link

I use st as my terminal which does not have the ability to toggle stylistic sets, and I need the ligatures for haskell where the bind operator (>>=) is used very often, making the code look bad.

@haneefmubarak
Copy link

@exorcist365 I think per https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets you should be able to use https://github.com/twardoch/fonttools-opentype-feature-freezer to bake the stylistic sets into a file that should work with your editor. I get that your Haskell code can look less pleasant than you'd like without the ligature in question enabled, but unfortunately much code in the most popular programming languages just flat out doesn't make any sense at all with the above mentioned ligatures enabled.


@tonsky do you think it'd make sense to close this too as #974 is closed already?

@tonsky tonsky closed this as completed Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants