Replies: 5 comments 26 replies
-
From my perspective, using Unicode is important. The code will look more like math and physics expressions, which makes easier to understand and convince people to use and adapt it, even if they are not very used to program in Julia. |
Beta Was this translation helpful? Give feedback.
-
I agree that using Unicode is very nice and hope we keep on doing it. This unfortuantely means that some problems will arise. Maybe we can suggest a default editor in case people have problems that is more fool proof than others? |
Beta Was this translation helpful? Give feedback.
-
There's nothing wrong with providing a Unicode API. Unicode is great. It is quite problematic though to provide APIs that require unicode. There should always be ugly ASCII fallbacks. |
Beta Was this translation helpful? Give feedback.
-
Hey all, From an outsider's perspective who just recently started trying out Oceananigans.jl and other related packages (really enjoying them overall!), the use of unicode was the biggest annoyance for me. Thus I would highly recommend option (2) above. For the record, this is the only Julia package I've encountered which uses a unicode API. I think unicode in scripts is fine, but for APIs it is too subjective to enforce. While there are plugins I can install for IDEs to support it, there are so many things which break:
The argument I've seen in favor of unicode is that it looks better, but I can't see this either. LaTeX math looks good, but unicode math looks terrible (subjective opinion!). It would be great if Anyways, this is all subjective. I think the point is that some users (like myself 🙂) are very anti-unicode - and thus an API should not enforce its use. Again, awesome package! Happy either way you choose to go. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure how relevant this is gonna be, but I'm gonna leave this here in case it can help someone. In Linux you can easily(-ish) have your keyboard type unicode. There are a few ways listed here. I do this (and set specific bindings for more common characters like ∂) and thus I rarely need to rely on any editor to type any of my code. The easiest thing, however, is to follow what's described here and add a greek layout to your keyboard, with a shortcut to change layouts. I do that too, and by pressing |
Beta Was this translation helpful? Give feedback.
-
On slack we recently had a conversation with @robertwhelber and @aramirezreyes about the downsides of unicode in our API. There are really two issues:
Some unicode symbols are not supported by some fonts. When a font does not support a certain symbol, readers see
⍰
instead. There's even a julia-specific font called JuliaMono that has "reasonable Unicode support" to at least partly solve this problem.Not all text editors support Unicode entry. For example, vim requires a plugin (I use Vundle with
Plugin 'JuliaEditorSupport/julia-vim'
). @robertwhelber also reported a problem with VSCode on his machine.This two issues mean that for some users, getting started with Oceananigans requires more than just installing Julia and typing
pkg> add Oceananigans
.I think replacing Unicode in the source code is not only a gargantuan task but would also severely impact readability of the source code. We make widespread use of Unicode to produce easily readable, distinguishable operators like
δxᶜᵃᵃ, ℑxᶠᵃᵃ, ∂xᶜᶜᶠ
and we feel that unicode has solved some tough issues (eg making sense of the combinatorial explosion of operators required for staggered grids).However, it may be possible to
Simulation.dt
instead ofSimulation.Δt
Unicodeless
" API somehow...nu
rather thanν
,dx
instead of∂x
,phi, lambda
instead ofφ λ
?The problem with 1 is that it's just a half-measure that might reduce the quality of our API without really solving anyone's problem.
As @simone-silvestri said
As for 2, it would require work and maintainence. However it's possible that we (or even someone else) could support option 2 as an external package, by redefining some key constructors and functions and re-exporting the already-acceptable versions.
My personal opinion that that using Unicode is important in making "code look like math" and writing "scripts that look like papers", and therefore a cornerstone in achieving one of our missions. However, I think we're also going to fail at achieving anything if lots of people are turned away at the door by Unicode.
Beta Was this translation helpful? Give feedback.
All reactions