JuliaMono – a monospaced font for scientific and technical computing
juliamono.netlify.app
juliamono.netlify.app
I'm legitimately on the fence about this.
I recently re-watched Guy Steele's 2017 PPOPP on "Computer Science Metanotation", and aside from wanting to make CSM an unambiguous formal system, he specifically says at one point that he wants tools to support CSM as it appears (i.e. with stacked overbars, gentzen-style inference rules, etc) because "anything else is a translation".
And partly I get that. There is real cognitive work if you have to constantly translate back and forth between two representations of the "same" thing.
But should we favor readability or ease of interaction / modification? Keyboards give you a way to insert a sequence of characters. Notations that are not graphically linear (e.g. a symbol that has both a subscript and a superscript) create an ambiguity about how you input them. "Modes" where we display something different than what is typed can create ambiguity about how to edit them.
And if a tool only covers 90% of the notational convention you care about, it quickly gets frustrating as you repeatedly bump up against that boundary. I experience this in emacs org mode with "symbol" support.
You input characters using the same notation as latex (IE \mu or \hbar) and then tab autocomplete to unicode. Even jupyter notebooks support that convention. Most people in Julia's target audience know latex already and so there is zero learning curve.
It did hugely simplify my scientific code where I already had variable names like hnu, omega_squared, and k_prime_prime which become arduous when checking against long equations.
Is Julia's target audience really that small? Either that or you'd be surprised how many people don't use LaTeX but do write scientific code and papers.
And if the people don't use enough symbols in their papers to memorise the type-able names, they probably don't want to use them in their code in the first place.
Just like with natural languages unrelated to yours, it's the grammar that really does your head in, needing just the vocabulary is Easy mode.
If you don't want to use the, but do want to enter unicode, then you can do it the normal way. But I feel like the fact that you want to enter unicode but don't want to install a plugin to make it easier is pretty weird. I guess it could come up if editting someone elses code. As a general rule most libraries (including the standard libary) make very limitted use of unicode in their APIs, so you don't have to use unicode to work with the library.
I would go so far as to say if a library requires you to use unicode you should open an issue, and get them to add a ascii alias for that function. (julia standard library had just such an issue opened a few versions ago about the compose operator ∘ and not we have a `compose` function to match).
I would also say internally most packages make very limitted use of unicode also. Even with the plugins it is still a bit annoying to type. Plus often it would be a less meaningful variable name. E.g. why say: θ, when you could be saying `departing_assent_angle` or something else that conveys context specific meaning. Its nice to have the option for when it is clear, but I think pleasingly people only use it in moderation.
Humans have been using nonlinear notation in a wide variety of fields, but computer programming languages seem especially stuck on plain text everywhere, despite the utility of such notation. I would rather faff around for a minute or two trying to figure out how to change my integration limits in a comment than leave some horrendous documentation comment like “computes the integral from a to b of the blah blah blah blah” and by this point because you can’t see the familiar notation, you first have to interpret it before checking the function. (Several PhD students I know working in applied mathematics and physics will “translate” these comments from code onto a scrap piece of paper in front of them, before attempting to dig into the function).
Personally I think it would be great if I could embed more rich text (styling, equations, and images) in comments to better communicate my intent. This stuff otherwise just winds up being left out (because it’s too hard), or in some other separate documentation which is difficult to keep in sync during development.
The over bar example you give is a bad notation independently whether it is code or not. But Unicode indices and superscripts are amazingly useful. And .dot and .kron are simply terrible notation compared to the standard Unicode operators for the same operations.
When I was at the university, most of the software written here was single purpose, rarely more than a couple thousand lines - you've got the time to actually think about every step of the few algorithms that'll be in there.
My last freelance gig was about delving and fixing performance bugs in a multi-million-line codebase that I'd never seen before, in a few days' time. There is absolutely no time to stop and think about ⊗ vs ⊛ in that case.
I normally use Inconsolata at "11 point" (quotes because this is a nominal value, not actual) size; JuliaMono is larger when used at the same nominal size, but going down to 10pt results in a level of graininess that I don't find acceptible.
Great effort, but I'll stick with Inconsolate for now.
It has an alternate, lighter asterisk.
I’ve used Courier as my coding and console font for a long time, as it had the right character design and stroke width choices to make reading really easy, even at small font sizes.
A lot of modern coding fonts are taller and thinner. I’ve tried Fira Code, Source Code Pro, Consolas, and others each for a week or so, and found myself struggling to read identifiers and punctuation as well as before.
This font however hits all the same points and is instantly readable for me. Thanks for sharing!
No difficulty producing columnal or tabular data on the first attempt was forseen.
When FORTRAN programming came along, you wanted the characters to line up in columns properly too, expected with the simple dot-matrix fonts.
Daisywheel printers all had mono Courier, with some starting to also autodetect mechanical PS printwheels when inserted.
Dot-matrix printers got better fonts than DOS itself but what you see on the screen was not very much of what you got on the printout the first time. PS could increase woe. Courier was available both ways. But tons of people stuck with the simple characters like you get on the cheap store receipts.
DOS text files using a monospaced font can be reselected to a different monospaced font without all the formatting difficulty you can get otherwise.
When Windows got popular, loads of people found out their old dot-matrix printer had been capable of beautiful PS output the whole time, it had just been out of reach without a WYSIWYG drafting approach.
You can still set your email window for a monospaced font, and draft a message into a Notepad window set for mono, intentionally with all the sentences of each paragraph on a single line when Word Wrap is disabled (disable Word Wrap before copying & pasting), and with a single line space between these _paragraphs_.
Then just copy & paste the whole text linewise from Notepad to different email windows and their mono spacing can be a good way to make the different local & remote word wraps work with less headaches.
Courier's remaining universalness still makes it a top choice for this type of thing, but a new monospace font that can serve as a functional superset is good to have.
Check it out here: https://input.fontbureau.com
Some other fonts I've been using lately are: Cascadia Code, JetBrains Mono, Monoid, Pragmata, Luculent, VL Gothic, Luxi Mono.
Usually you just set a fallback CJK font and just not use my native language while coding - I just got better at English while writing comments in it.
I'm excited to spend some time trying this out.
Bit too wide for my taste, I fall on the Pragmata Pro/Iosevka side of preferring a more condensed font for code.
But otherwise this is really a very impressive effort, and it was cool reading functions that truly benefit from the expressive Unicode character-set.
> It makes it easier to read the code for everyone
It doesn't make it easier for some people including myself so I can certainly say it doesn't make it easier for everyone.