3 ms·
From looking through the article, and what's available online (Apple page and Wikipedia), it looks like they took most of what folks like about interpreted lang
by araes 12y ago
From looking through the article, and what's available online (Apple page and Wikipedia), it looks like they took most of what folks like about interpreted languages and just moved them into a compiled form, married to a decent debug / testing environment.
It also has a bit of Perl, in that its written so that patterns conform better to English speaking patterns. For example, they use the "let" keyword to do constants like:
let appleSummary = "I have \(numberOfApples) apples."
and they use Javascript-like simple concatenation operators like:
str = "hello,"
str += " world"
And like Perl, I also like that associative arrays / dictionaries are top level:
let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25]
After that, it mostly looks like standard evolution. They've taken many of the top, or high use programming patterns of the current day for i-products and rolled them into libraries or main functions to speed up development.
It could be good. I do like Javascript and Perl, which look like they had a child with Objective-C. And that article has a point that its only main competitor is Obj-C, which is not much of a fight. Now if they'll only allow you to develop and build on non-Apple hardware.
- SideburnsOfDoom 12y ago> And like Perl, I also like that associative arrays / dictionaries are top level: let people = ["Anna": 67, "Beto": 8, "Jack": 33, "Sam": 25] Is this a perl-ism? It's not much more inference than C#: var people = new Dictionary<string, int> {{"Anna", 37}, {"Beto", 8}}; or a JavaScript array of objects. Also "+= " on strings extends beyond just JS (it works in C# too) and likely several others. Whichever more modern language you're familiar with, you'll probably see an echo of it there.
- wtetzner 12y agoI think let for bindings actually comes from ML. It looks a lot like what you get when you try to take what you can from functional languages while still being an imperative language.
- kbenson 12y agoI don't consider the "let" example to really be very Perlish. The real power of Perl in it's natural expressiveness is to more closely map speaking, and thus thinking patterns to how the algorithm is represented. For example, postconditionals, which allow a single statement to be conditional based on a condition that immediately follows it. This is a natural way people express themselves ("do X if Y" or "do A unless B"), but it is wisely restricted to a single statement as the alternative is less common, less clear. The fact that swift's let statement sounds like common English when spoken aloud is only superficially similar to Perl, IMHO. Additionally some sort of hash/associative array/map data structure at the top level is (thankfully) common at this point. I haven't followed swift too closely though, so maybe there's other stuff that I would consider more aligned with the spirit of Perl.