I hesitate to add my two cents, for all the derision I’m sure to attract for going overboard, but personally I come down very strongly on the side of using UTF-8 in my own code, while ensuring that the API allows people to use either UTF-8 or ASCII.
My community’s literature has very strong and fairly consistent conventions for a lot of variables, so it really helps to make the code look familiar. On the other hand, my highest-level API will often be used from python, where even something like M₁
is not allowed. So I make sure that my API accepts keywords in both forms with code like this:
function orbital_evolution(
M₁, M₂, χ⃗₁, χ⃗₂, Ωᵢ;
Lambda_1=0, Lambda_2=0, Omega_1=Ωᵢ,
Λ₁=Lambda_1, Λ₂=Lambda_2, Ω₁=Omega_1
)
# Code that only uses the Λ₁, Λ₂, Ω₁ forms
Yes, it’s possible for users to pass both forms of the keywords and one will be thrown away, but the documentation only suggests that it is possible to use one or the other, so I don’t think it will come up. And now, I can make beautiful calls like
orbital_evolution(M₁, M₂, χ⃗₁, χ⃗₂, Ωᵢ; Λ₁, Λ₂)
while the spoilsports () would probably write that as
orbital_evolution(M_1, M_2, chi_1, chi_2, Omega_i, Lambda_1=Lambda_1, Lambda_2=Lambda_2)
Similarly, some function names can be made pretty, while allowing ugly calls:
μ(M₁, M₂) = (M₁ * M₂) / (M₁ + M₂)
const reduced_mass = μ
I may be opinionated, but my APIs can be flexible.