Choosing a programming language revisited
A comment from someone on Hacker News who happened to stumble across this site, inspired me to give another look at rust as a programming language. Having spent a few months digging into C++, my initial thoughts are that as pros:
- ICU for Unicode support
- harfbuzz for text rendering
- within the limits of compiler support for bleeding edge features, code should be widely portable by sticking to standard C++
and cons
- library support is painful. I’ve been spoiled writing for the JVM over the last 13 years. I can easily add a library to a Java project by just adding a dependency to my pom.xml and I’m done. Since there is no real standard for C++ object/library files, adding a library often means downloading and compiling from source. It’s not uncommon to deal with dependencies by creating a git submodule and if you’re lucky, it will have a CMake configuration that allows it to be used as a subproject.
- Lack of a standard project structure means that there’s a lot of mental labor involved in just figuring out where to put files.
- PDF creation seems to have only a couple of options, but they seem to not be actively maintained. libharu has a post on its homepage asking for a volunteer maintainer to take over and the mailing list has at least one volunteer who has offered only to receive silence. And libharu’s CMake configuration is a bit broken so it requires (a) some unmerged changes to build as a subproject and (2) some non-standard declarations in the master project to integrate it.
- C++20 is still not quite all here yet. I had hoped to use some features including modules and ranges in my coding, but it appears that these are not yet supported by clang. I have an irrational resistance to gcc and a rational resistance to msvc but both of those compilers don’t fully support C++20 either. Again, Java world has spoiled me. It’s only inertia that keeps me from setting my compile level higher than Java 11 on stuff I’m working on right now.
So what about rust? Some digging reveals that people have used it as a development language for iOS. It’s still in its infancy, but it should be much better by the time I need to care. Since it’s really a single development system rather than an undefined galaxy of compilers implementing a common standard like with C++, they’re able to wrap up library dependencies using the crate mechanism. ICU and harfbuzz both have rust crates and there’s an actively maintained PDF creation crate.
And as an added bonus, I can use the rust plugin for IntelliJ (or CLion, although I may drop my use of that if rust works out).
The big negative is that rust is a completely new language to me, but then again, C++ has changed enough since I was actively using it in the 90s that so is C++.