4 ms·
Just reading all of this (I haven't used ligatures when coding), but the confusion between a ligature of >= and the Unicode ≥ (U+2265) could be handled by the l
by rswail 3y ago
Just reading all of this (I haven't used ligatures when coding), but the confusion between a ligature of >= and the Unicode ≥ (U+2265) could be handled by the language parser accepting either to mean "greater than or equal to".
Would moving beyond ASCII be that much of a stretch for modern languages?
- pwdisswordfishc 3y agoI can’t wait for a programming language that considers the strings ">=" and "≥" to be equal.
- eloisius 3y agoMost modern languages already use Unicode for variable names and such. But why would you want to type a Unicode lte/gte character? I’m sure it’s not that hard on a Mac keyboard, but can’t be easier than <=
- xigoi 3y agoBecause readability is more important than writeability.
- eviks 3y agoOf course it can be easier since <= are a shifted char and a very far pinky char. Yes, you'd have to use a keyboard remapping tool to make it easier And the most basic reason is because a dedicated symbol looks much better (and doesn't break vertical alignment since it's one glyph)
- jeroenhd 3y ago> Most modern languages already use Unicode for variable names and such I've never actually thought about using comparative characters, but that actually makes a lot of sense. I think people will disagree if you use them, but there's no reason why you wouldn't be able to call a variable x≥y≤z…
- layer8 3y agoYou could make “>“ a dead character that combines with “=“ to “≥”. Then it’s just as easy to type (at the price of a verbatim “>=“ becoming slightly harder to type).
- zokier 3y agoModern languages do have unicode operators. See for example Julia[1] and Raku[2] [1] https://docs.julialang.org/en/v1/manual/mathematical-operations/#Numeric-Comparisons https://docs.julialang.org/en/v1/manual/mathematical-operati... [2] https://docs.raku.org/language/operators.html https://docs.raku.org/language/operators.html
- toastal 3y agoAgda & PureScript support it, Haskell with the Unicode pragma too
- lizmat 3y agoNote that the Raku Programming Language has pure ASCII equivalents for all operators as well, for the Unicode challenged. E.g. ≠ vs !=, ≤ vs <=, ≥ vs >= etc. etc.
- sundarurfriend 3y agoSame with Julia too.
- nottorp 3y agoThat's fun but how do I type them?
- chrismorgan 3y agoA Compose key is the best general-purpose way. For example: • ≥: Compose > = • ≠: Compose / = You can define your own sequences too, if you want. I like to type exactly what I mean, including curly quotes and dashes and narrow no-break spaces and emoji and so on, but often didn’t like the default mappings (if there were any). As an example, I use this for curly quotes (look at the keys’ locations on the keyboard to understand—it’s coherent): <Multi_key> <semicolon> <semicolon> : "‘" <Multi_key> <apostrophe> <apostrophe> : "’" <Multi_key> <colon> <colon> : "“" <Multi_key> <quotedbl> <quotedbl> : "”" (The only thing I can think of where I don’t normally type what I’d theoretically like to is hyphens, where I use ASCII’s HYPHEN-MINUS instead of the proper HYPHEN. I’ve never come up with a mapping I like—what with en dash, em dash, minus, &c.—and it’s also too common for fonts to lack a HYPHEN glyph.) When you’re used to this sort of thing, it comes completely naturally. Somewhat more information: https://en.wikipedia.org/wiki/Compose_key https://en.wikipedia.org/wiki/Compose_key
- sundarurfriend 3y agoJulia does this: help?> ≥ "≥" can be typed by \ge<tab> search: ≥ >=(x, y) ≥(x,y) Greater-than-or-equals comparison operator. Falls back to y <= x. Examples ≡≡≡≡≡≡≡≡≡≡ julia> 'a' >= 'b' false julia> 7 ≥ 7 ≥ 3 true
- RobotToaster 3y ago#define ≥ >= You could even compile a bunch of them into a header file.
- bombcar 3y agoAPL says hi. life ← {⊃1 ⍵ ∨.∧ 3 4 = +/ +⌿ ¯1 0 1 ∘.⊖ ¯1 0 1 ⌽¨ ⊂⍵}
- layer8 3y agoThis is a problem insofar as when searching for “>=“ or “≥“ you will only match one of them, and you are prone to getting a mix of both in your codebase. Ligatures effectively create a non-canonical rendering, and then adding a non-canonical alternate encoding doesn’t really improve the situation. A proper way would arguably be for the programming language to only understand “≥“, and for editors to provide support for entering such characters (or the user can configure a system-wide Compose key or similar). IMO we should work on standardizing keyboard input for those symbols instead of de-standardizing code display via ligatures.