Hasklig
Hasklig copied to clipboard
/= ligature doesn't work well for Ruby
In Haskell, /=
is the not-equal operator, so it seems obvious to map it to ≠
But in Ruby (and presumably other languages, too), !=
is the not-equal operator and a /= b
is a shortcut for a = a / b
:
i = 10
i /= 2 #=> 5
i #=> 5
# vs.
i = 10
i != 2 #=> true
i #=> 10
Using the current ligature makes the code quite confusing:
i = 10
i ≠ 2 # will this alter i or return true?
I'm not sure how to solve it, but maybe there should be a language-agnostic base font and specialized language fonts.
We can use other ligature for /=
like Fira Code:
It still reassembles intention but is less similar to ≠
. Other option would be using other ligature for !=
but unfortunately /=
isn't much popular as compare operator and !=
is popular one.
@hauleth that looks good. I think the font should not attempt to interpret the characters or imply a meaning. It should merely make them look a bit nicer, IMO.
Alternatively any of them should look like ≠
. Both could just fix spacing between symbols.
Alternatively any of them should look like
≠
Sorry, I don't follow. Do you mean "none of them"?
I agree with @sos4nt that the font should not attempt to interpret the characters or imply a meaning. I personally would be confused to see ≠
is ruby code, though I am familiar with both Haskell and ligatures. I just don’t expect a table to magically become a chair when I sit down it.
On the other hand, /=
is the division shorthand in many languages, in my opinion, it would be fine to fall back to Fira Code’s approach to preserve the meaning of /=
in each language.
Nifty !=
ligature, just sticking !
and =
together would be fine for not equal in ruby-like syntax.
It's obvious that having a single font (with ligatures) for all languages is a problem, and this is yet another example.
The ideal situation is multiple font versions, and IDEs and editors that allow setting font per syntax (language).
@hauleth But FiraCode cannot be used in Haskell, because they break ligature laws substituting !=
with ≠
, so you may be confused when encounter ≠
instead of !=
in Haskell code.