tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.42k stars 92 forks source link

Unicode operators #1328

Open yannham opened 1 year ago

yannham commented 1 year ago

Discussed in https://github.com/tweag/nickel/discussions/1327

Originally posted by **toastal** May 27, 2023 I would like have the _option_ (meaning supporting both) to use Unicode operators to mean what I type with the literal and appropriate Unicode symbols instead of having ASCII symbols approximate those Unicode symbols. Input is a solved issue (layers, compose, digraphs, etc.). I would propose all or some of: | Unicode | ASCII | description | | -- | -- | -- | | × | * | multiplication | | ÷ | / | division | | ≡ | == | equal | | ≠ | != | not equal | | ≥ | >= | greater or equal | | ≤ | <= | smaller or equal | | ∧ | && | and | | ∨ | \|\| | or | | ¬ | ! | not | | λ | fun | function | | → | -> | type-level arrow | | ⇒ | => | function-level arrow (?) | | ∀ | forall | universal quantification | This is just going through the docs quickly. There isn’t like `U+XXXX RECORD MERGE` so operators like `&` are an arbitrarily picked symbol (which is okay). Not a solution: [ligature abuse](https://practicaltypography.com/ligatures-in-programming-fonts-hell-no.html)
yannham commented 1 year ago

After some chat, the simplest way to go right now is simply to have some unicode operators be alternative valid input for the corresponding symbol (e.g. ∀ equivalent to forall). We don't plan on making this configurable, and the pretty printer (e.g. printing types in error messages) would still use the non-unicode symbols. Doing so people can still use unicode input if they want to at a low maintenance cost for the Nickel project.