Anyway, this is not a complaint about the language (which I like very much), just a dislike of the popular usage
In any code you write, you should be asking, "how will people check this?" If the answer is "by comparing it to something else," then it should resemble the original as much as possible. If the answer is "by thinking about it," then it should be formatted for self-contained comprehensibility. The distinct use cases lead to different best practices.
For the record, I'm not a blackboard addict, I never had a career in academia and I'm not even really a member of Julia community any more than any other person who wrote maybe a couple thousands of LoC in Julia. But I wish people would realize it's not 1970's anymore, and ASCII is culturally outdated. For that matter, I would love if I could write formulas in my code the same way I do on paper, like in that MathJax sample from the article. That's why math notation exists at all, imperfect as it may be (and I hate many things about established math notation, but it's the best we have). I just don't see how it's possible without abandoning plain-text, which I surely wouldn't like because we (currently) don't have tools that would make handling it as effortless, as editing text in Vim.
The fact is it's easier to type "mu" instead of "u" (like right now, I can't be bothered to look up "mu unicode", or open the special characters picker, or exhaustively brute force alt-gr key combos to find the mu).
Take it a step further, I wish physicists and mathematicians would stop naming their variables so poorly so that only the most seasoned of their field can follow along.
Sometimes, like v (velocity) it's quite obvious, at other times I find myself staring at scripts with insane variables like a,o,t_o, etc. And this is a habbit that seems to carry over to non-academic code as well. It's trivial to spot code written by a mathematician because it tends to be incredibly obfuscated.
Do you really need to name your constants K_(single letter)? Or can you just write "AIRDENSITY" once and let your editor autocomplete it in the future?
The reason I complain about these symbols is because they don't have clearly defined meaning. Maths/Physics had to pull out the Greek alphabet after it exhausted the Latin alphabet (and overloaded most letters with 2 or more meanings) and then promptly molested the Greek one in the same way. Just look at Omega. It's useless. It has been overloaded with so many possible meanings that it has none. Stop naming your variables "omega". Unlike Maths, programming languages support variable names of more than 1 character long.
Honestly I really hate seeing mu_a, delta_k and company all over the place. If we are gonna name our variables like this might as well give us the actual characters
your criticism of Perl is unfair. Base perl has supported unicode variable names since more than 20 years ago, way before all the other languages that you speak about.
For example these equations look similar,
x^2+4x+5=0
y"+4y'+5=0
Even though one is a polynomial equation and the other is a differential equation, the common visual pattern suggests that the techniques needed to solve them may be similar.
On the other hand in programming there's no need to do this, all the math has already been worked out on paper, so it's better to use clear, distinct, easy to type variable names.
How important is form when I'm programming mathematics?
Why would I use the variable name "probability_distribution_on_m" instead of "rho_m", when I know all along what rho_m means in the contexte of my code (the symbol use throughout the paper). Usually, I comment at the beginning and specify what the variables mean and to what they correspond in the paper. And if somebody needs to read my code, that person will need to understand the paper first. More descriptive variable names won't make the person understand the paper better.
Of course, when I am writing some non-scientific software, I will use descriptive variable names, because there is no complicated formula, no paper that sets the context of the code, and it makes sense in general to have descriptive variables for logic elements for a clear code.
Edit:
There are like 5 replies to this mentioning different ways of doing it (including memorizing 3 digit unicode values) none of which seem more intuitive than writing "mu".
We're in the 21st century, all the tools we use should have reasonable Unicode support. The fact that we collectively keep on talking about typing non-ASCII characters as a real problem is a pretty depressing reflection of our shared computer infrastructure :(.
Write for the convenience of the reader, not of the writer!
Also, Emacs has an input method which supports "\mu", and this convention is also used in Racket for things like λ.
I agree that we need better system-wide tools for arbitrary Unicode input. Font support and confusable glyphs are also issues. But I think these are solvable problems, and they will be good problems to have solved.
\mu<tab>
You just type \mu and then hit the tab button and you get μ. I actually switch over to my Julia REPL all the time when I’m emailing someone and want to type a greek character.
The solutions to those problems is to use better fonts, terminals, and editors. Using Unicode characters is fine but some people do have legitimate problems with them.
Typing certainly does add more friction between u and µ than a chalkboard would, though it is perhaps also notable that mathematicians seem to have felt that it's worth the effort, and have come up with a quite nice system for it in LaTeX -- and I would certainly not mind seeing more languages and editors add support for LaTeX completions the way the Julia ecosystem has.
Not all fonts are good fonts for an evey use use; heck, not all fonts make 0 and O or 1 and l and I clearly distinguishable.
> The solutions to those problems is to use better fonts, terminals, and editors
Exactly.
Some proper use casees IMHO are: 1. in "terminal" code: scripts, notebooks. 2. function internal variables 3. for making the code look like their counterpart of a paper.
idk what to think of 3. if you look at any paper, non of them only uses ASCII, which raises the question, if we're happy with reading papers (even CS ones) with symbols, why not in our code?
Maybe I'm behind on this, but needing to use the mouse to find symbols in a huge menu is very painful.
You can copy and paste too but again, huge break of flow.
Do some editors support discord-style emoji syntax, where typing :fo would bring up a menu of emojis that might match foo. Then hitting enter inserts the emoji over the :foo: representation. You can also not use the auto complete menu.
Ex. :pow2: might turn into ²
EDIT: In general it makes sense to set up your keyboard with a compose key and a “dead Greek” key, and set up your Compose table so the shortcuts make sense to you. Then you can use an expanded set of symbols everywhere, including comment boxes like this one. You can even put things like your email address in your Compose table.
Better yet, you can reverse look up how to type a thing:
help?> χ²ᵢ
"χ²ᵢ" can be typed by \chi<tab>\^2<tab>\_i<tab>On the other hand, if you're going to use \mathfrak{i} to index a simple loop you're doing it wrong.
So, if you are maintaining code where that is the idiom, use a font where that isn’t an issue.
You can also put Greek symbols in superscripts or subscripts and that works just fine.
Do you think the Symbolize (or the Notation package) are useful? I don't see any examples in the docs, so hard to tell.