Warning against Unicode confusables

I agree that this is a real concern — as I wrote in another post, it’s important for newcomers to realize that they can use Unicode symbols in their code, but they are not required to do so in order to program in Julia.

The question is, what are actionable ways to help address this concern? Unicode isn’t going away — many people in computational science are not going to go back to writing alpha and beta as variable names once they realize that they can write α and β, nor should they have to. Some possible things to work on might be:

  • In tutorial materials aimed at beginners, encourage people to be cautious about Unicode symbols. (You should introduce them at some point, because people will see them in other Julia code, but make sure to emphasize that they are optional, and definitely don’t include them without explanation.) I recently submitted a PR to the Think Julia book to correct just such an issue (replace "🐢" with "turtle" in examples by stevengj · Pull Request #61 · BenLauwens/ThinkJulia.jl · GitHub), though I’m not sure when/whether it will be merged. Clarifying patches submitted to other tutorials might be helpful too.
  • Something in the Julia manual to emphasize this? A new FAQ, or edits somewhere else, a blog post? If you have a good idea for this, please feel free to submit a PR aimed at clarifying this issue to newcomers.
  • Maybe an addition to the style guide, suggesting that public APIs should typically be ASCII or have ASCII synonyms for accessibility. (Of course, people in specialized fields may choose to disregard this, just as people can disregard anything in the style guide if they wish. The point is not to shame people, but to make sure they appreciate the tradeoffs here.)
  • If there are isolated Unicode-only APIs in packages (i.e. some random little thing, not a package designed top-to-bottom to use Unicode symbols), a PR to add an ASCII symbol might well be welcome. (No, xor doesn’t count here: lack of an infix operator ≠ lack of an API.)
  • Implement warnings about confusable symbols in linting tools. (I opened an issue for Aqua.jl).
  • Others?
11 Likes