3 ms·
Nah, ligatures are fine. Most of the time they’re used in situation where we are literally trying to create new character by combining others. Like |>, =>, !=,
by josefrichter 5y ago
Nah, ligatures are fine. Most of the time they’re used in situation where we are literally trying to create new character by combining others. Like |>, =>, !=, ===, >=, ~=, etc. The individual characters don’t have semantic value on its own, only the combination does. Then it’s quite fine to display it as one ligature character. What I mean is the meaning of |> is not a combination of meaning of | and meaning of >.
- quelltext 5y agoThat really depends on the programming language. For example {| might be paired with |} as special quotation syntax, at any rate some form of bracket. See, Fira Code has a ligature for those. But in Ruby you'd see one of them in one liner blocks, e.g.: list.map {|x| x*x} Here {| is not a thing that should be combined. It would look really confusing as you'd search in vain for a corresponding closing special bracket. { and } denote the block and | and | the argument(s). How symbols are combined to form meaningful units depends on the syntax of a language and this issue cannot be avoided. So your milage may vary. I'd be on board more if ligatures were applied in a language specific way, aware of the meaning of tokens in context, e.g. to leave <= in string literals alone, render it ⇐ when used as an arrow (maybe in a language that has left arrows), and something like ≦ when used in a comparison context. But the same thing being rendered in different ways may be very confusing (unless there's an easy on/off toggle).
- josefrichter 5y agoThese are rare exceptions and I think formatters can usually deal with that. I believe it’s also possible to disable specific ligatures (ie not disable all ligatures, but just blacklist those that don’t work in given language)