New Programming Language, again
Jan. 11th, 2022 11:58 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
A while ago – 8 years, in fact – I wrote about the search for a new programming language. (You can read that here.) This is indeed a while ago, and the situation has changed.
While it may still technically be true that programming in C fed me well for most of my professional career, at least it doesn't feel like it any more. I have done lots of stuff in Java and Perl and recently in Python, and my current job isn't even so much about programming any more. The part that is, is with Python.
I like Python. I like it so much, I have written not just one Lisp interpreter in it, but two. But Python has its weaknesses. The absence of strong static typing is one thing; and when you are writing – and using – an interpreter for another language in it, you'll notice it is slow. Dead slow. About the strong typing – that may sound a bit ironic in the context of a Lisp interpreter, because Lisp is famously not statically typed. But a Lisp interpreter that goes a bit beyond minimal does have a certain complexity, and that goes with things like "what type of data was I exactly expecting here" becoming a bit blurry in my head. "Was it Python strings, or Lisp string objects? Or..." Yeah right. That bit me, baby, one more time, or, in other words, oops, I did it again!
But mainly I stopped going on with the Lisp interpreter in Python because Python was just too goddamn slow. With respect to argument lists I went with the Scheme-like (a b c . rest) argument list format to implement a variable number of arguments at first. I wanted to do the CL-like &optional, &key, and &rest mechanism, as I had done it in the Go implementation lingo, later, but that I gave that up because that would have made the argument list processing even slower.
I had a go (pun not intended) at the language Nim, which has static typing, (some) type inference, automatic memory management, and compiles to a fast (so it claims) executable. Sounds like just what I wanted. But it turned out I had a hard time understanding it, and it seemed to rub me the wrong way, all the way.
Then I jumped on Swift. Swift, like Go (and Java) a product of one company, had caught my eye a few years ago. I dismissed it then, because it was not open source and not available on more than said company's platforms. This has changed in between, and while a FreeBSD port apparently did not find enough resonance and went stale, Swift is also available on MS Windows (who cares) and Linux. As all the world's Linux nowadays (except for that company's own platforms), that's good, right? Let's say it is.
I am still making my way through the Swift Laguage Guide. That is not yet the Language Reference, but it is a step up from the Swift Tour, and it already goes into a lot of details. What I have seen so far I like, and nothing in there has rubbed me the wrong way the way that much of Nim did. Unlike Go (and Nim), it is truly object oriented with classes and inheritance and things, closer to Python in this respect. It feels "lighter", easier than Go, more like Python, and not just (probably) much faster than Python, but also safer. Although with safety comes restriction. I'll see how it goes with that. Compared to Python the syntax is rather C-like, not unlike Go, but that doesn't really make a difference.
For now, everything seems to fall into place, feels right. The little gripes I have are mostly things about terminology, naming, matters of taste that I can overlook easily. For now, it seems as if this is the thing I was looking for. Let's see; I am curious to find out.