Unicode is amazing, don’t get me wrong.
typealias ℂ Complex{Float64}
function Base.angle(z₁::ℂ, z₂::ℂ)::Float64
α = abs( angle(z₂) - angle(z₁) )
return min(α, 2π-α)
end
yum yum yum. A scrumptious math munch and no mistake! Tangible benefits. Massively easier to read code. Code mirrors formulae and notation conventions in academic papers. Also with so much choice, we can use glyphs artfully to indicate purpose. A matrix can use different glyph from a vector. I can use 𝒳, 𝒴 = ...
as containers, for 𝓍 in 𝒳
etc, and I’m still free to use x,y,z
. I don’t run out of letters, so I don’t need long variables. Long variables can’t be parsed by our visual cortex as efficiently (the fovea can only handle 3-4 letters at a go, so you will notice you can instantly spot 𝓍
above whereas you’ll have to hunt to find the word “choice”.
It’s a huge Win!
But are we not simply jumping from the frying pan of ASCII to the fire of Unicode Font Hell™?
e.g. \vec
fails to render with the default Atom font. \cdot
fails to render with Roboto Mono. 𝑳 fails to render here (that should be a capital L lookalike, works in Atom, fails in GitHub).
This is going to be a nightmare, if I can’t display a random .jl
I find on GitHub without knowing which font it was built with. It’s going to really grate.
I would still rather Unicode Hell over ASCII. But maybe we can get the best of both worlds? We could start collectively agreeing on a Julia font. I like the idea of that. That would get us out of the immediate danger zone.
But what if we look further ahead?
How about having actual math formulae rendering in code?
So something like:
x = \frac{a}{b}
would render as a proper formula whilst simultaneously invoking frac(a,b)
for some frac
function. So you can edit the code in the same way we use MathJax in documents, and you can additionally render the code.
The experience might be similar to this Discourse editor, where you manually edit the markdown file in the left pane, and it dynamically renders in the right pane.
This might be doable with a reasonably light layer over Julia, although I think it might rupture its co-evolution with JuPyteR notebooks.
It would have a huge advantage in that we would return to ASCII.
Also by displaying formulae correctly it would allow a whole new dimension of expressiveness. And if the coder can wire up the corresponding MathJax function names manually, there is pretty much no end to the potential ingenuity.
We seem to be moving into a paradigm where people are realising that we spend much more time reading code than writing it, so by shifting the burden of effort towards writing it’s actually creating an overall win.
I think that in years to come we will look back upon this Unicode explosion as a short period of chaos.
Is anyone interested in exploring this avenue?