RSS Feed

Monthly Archives: May 2015

Apple’s new language (oh, update, it’s new again), Swift

Apple has a new language called Swift.

Oh, it’s been updated, it’s new again and now all my old files don’t compile. (sigh)

One thing I really, really like about Swift is that it fixes a lot of problems that were inherent in Objective C. Don’t get me wrong, I’m a bare-metal kind of person. I really do not like interpreted languages. I can give you many reasons (speed, speed, speed), but primarily it would be speed.

Swift is the first language that I have not worried about speed. It feels like bare metal (even thought I know it isn’t – a parser that I rewrote in Swift ran HORRIBLY slow until I reworked it and make it more Apple-y).

It is a language in progress. Yes, that progress can be annoying. One day your code works, then an update arrives and now it is broken. Googling can get you answers that are completely wrong. Apple’s documentation at times is a wee bit too terse. No, what is the word that is more terse than terse? Oh, right, “missing”.

But it’s not a bad language.

So why are people actively hating on it? I suspect they have very little knowledge of other languages. For example, PERL (or PERIL) to me is a write-only language. I once was required to modify a small section. It took me ages (probably a week). But even though I KNEW what it did, it wasn’t obvious. Not because I used the secret handshake, there are at least five in PERL, but because the language is just so obtuse. This is why you see so few articles about bad PERL scripts – how would you know?

(Yes, some of you are good PERL writers, please do not inundate me with “PERL is great because…” – yes, I know the reasons, I just don’t agree)

Then we have the one language that I NEVER had a good understanding of: SNOBOL. SNOBOL is an incredibly powerful language. People have written compilers in several pages of code (I think I saw a C compiler written in five pages – sans code generator). However, it is so dense and hard to understand that it makes PERL look positively chatty.

Here is an introduction:

It starts off simple enough and looks procedural. Until you get to patterns. You have two parts that kinda-sorta work together. Here is a page laughingly titled “A Quick Look at SNOBOL”:

Okay, Hello World looks easy… what are you… holy guacamole what is THAT?!?! That would be the part where people who dream in regular expressions live.

We could delve into other languages like Lisp – a language designed for those who do not believe we have enough parenthesis in the world and who love counting them.

It’s not that I dislike these languages, I actually like Lisp, it’s that when deciding what is a good or a bad language, many of these people compare Swift only to C, C++ or C#. They think that “modern” (who came up with that moniker? PR? Shoot them) languages are good languages.

What I consider a good language is one that allows me to get something done and allows me to go back three months and understand what the hell I did (I may operate in C, C++, C#, BASH, Javascript or others depending on the situation). Something that is powerful, but initially opaque, is not a good language. Something that is terse to the point I have to look things up (like BASH) is not a good language.

Swift has the possibility of being a very good language. It certainly understands the concept of delegates better than C# does (if you think C# “delegates” are delegates, you might want to read my previous post).

Since it appears that Apple is moving all of it’s development to Swift, I have also moved my development to Swift.

Now if they will only open-source it…  =^.^=