Why I want Swift to be your first language
aaronblock.com
aaronblock.com
1. Where am I going to test my applications? Not all students have Apple's products (I never had any of them). On the other hand, if I use Python, or Java, or C/C++, I can test my application wherever I want.
2. As far as I know, Swift will be open source (at least, that's what Apple said). But Swift is not open source _at the moment_ (please correct me if I'm wrong).
3. Swift is a new language. If I type "Swift tutorial" on Google, and I type "Python tutorial" on Google in a second tab, I'll get much more relevant results for much more platforms when I type "Python tutorial".
I don't care how good the syntax is. If a programming language is not currently available on like every platform and if I can't build my application using whatever I want to use (including a text editor and a compiler), it's not a good choice for students no matter what you say.
He lists that there's no Windows IDE, which is far from being able to run the program everywhere and using whatever I want to use to build it (as I have said it). I also think that .NET languages (like Visual Basic .NET and C# .NET) are not a good starting language, even though one of them was my starting language thanks to my high school and my college (both taught me Visual Basic .NET for one year). Plus, he states that Swift is open source at the moment, which, as far as I know, is not true. He didn't mention any of those three points I made.
EDIT: Replaces .NET with .NET languages.
Well, that's sort of obvious, in that .NET is a platform for which many languages (VB.NET, C#, F#, Python, etc.) are available, not a language.
Right now the issue is library support - swiftc can already just spit out LLVM IR: https://github.com/kripken/emscripten/issues/2427
The stdlib would be included in the open source release.
Linux boxes would fulfill "non-Apple product" though. Unixy programming languages like Swift and Python have always been weird on Windows.
Even then, building some of the fancier libraries (with native code) by hand is bit involved.
In fact, Anaconda works very well on Windows, as long as you don't require extreme latest versions of modules.
Now, if Apple actually released the code of its Windows port of iTunes, will Apple actually care about it enough to accept the contributions from the community and make the community feel welcome? Will iTunes on Windows drastically improve as the time goes on? Will developers on other platforms accept it and use it for their products? How well does it behave when compared to other programming languages? There are too many unknowns.
Although I'd love to see that future, I don't think that this will happen. In theory, releasing the code of something is all that is needed to do to make something actually useful. In reality, things are not that simple.
And if you are using Java, not only can you test your application wherever you want, you can also write it wherever you want.
Languages that don't offer this multiple flexibility will have a tough time becoming a main teaching language in schools.
It's why I think Javascript is the best language to teach beginners. Yes, it's an ugly language. Yes, it has significant structural problems. Yes, it will bite you in hilariously difficult to find ways. But that doesn't particularly matter compared to teaching them that they can futz around with code and get interesting stuff done.
I'm the least fan of GC as anyone else but needing to have intro students worry about cycles seems like the last thing you want to teach first.
1) I want to use a single teaching language.
2) We need to teach them about memory management.
3) C style manual memory management is too hard for beginners.
If you accept #1 and #2, you can't start with a language with the full 'magic' of garbage collection, as it would have to be the only language, and you cannot teach #2 with it.If, in addition, you accept #3, ARC makes sense to me. You can have your pupils implement quite a bit of advanced data structures such as trees and tries before you hit your first cycle, but there are 'real' data structures that use them, so you won't have to make up some artificial example to find one. Until that time, you can let your pupils think that the machine reuses memory as soon as it is no longer referenced.
I think his arguments make some sense, but I am not sure I'm fully behind #1.
What he's wrong about is that the choice is C style, ARC or full GC. There's another intermediate step which is achieved by using C++11 smart pointers - manual reference counted memory management.
Don't believe anybody who uses either of these tactics.
- Python does not have a type system worth mentioning.
Python has a strong dynamic typing system, with metatypes, type rewriting and so on. You couldn't be more wrong. What it is missing is an easy way to declare interfaces - the idea is to use duck typing and handling exceptions when something goes wrong.
Introductions should be about learning how to reason about abstractions, and how to transform problem-solving from what's going on in your head into code. When you start out with something so rigid like C or Java you really confine a student's ability to reason about a problem because there's so much syntax to keep track of.
It doesn't make sense to run Swift (or Objective-C) without the underlying platform API. You can do it (and Apple does; iTunes for Windows is built with such a shim) but it's not practical.
The only reason Swift even exists is that no other language (other than Objective-C) fit with the object model of the OSX API. So they had to make their own. As much as other languages don't interface well with OSX is as much as Swift doesn't interface well with every other platform.
Objective-C wasn't created by Apple or NeXT.
https://github.com/MacRuby/MacRuby/wiki/How-Does-MacRuby-Wor...
And MacRuby itself is written using Objective-C.
Objective-C (and now Swift) is OS X's system language and they are not applicable as a system language for any other platform.
Most OSX apps and services still aren't even written in Objective-C and many (most actually) platform APIs are still in C.
You can compile Objective-C using the gnu compiler and have been able to for ages.
Swift is an amalgam of many different programming languages and styles, including Rust. None of which have anything specific to do with OSX/iOS about them.
I meant the low-level dispatch of methods; the application binary interface that Objective-C uses to communicate with the APIs that make up almost the entire OS X GUI API. You can't mix that with the ABI for Windows API or any Linux toolkit (except GNUStep).
> Most OSX apps and services still aren't even written in Objective-C
Most OS-X apps aren't written in Objective-C? Really? Come on. If it was written specifically for OS X or iOS then it's almost guaranteed to be in Objective-C.
> You can compile Objective-C using the gnu compiler and have been able to for ages.
Nobody says you can't. But the only real useful thing you can with that is link to GNUStep.
> Swift is an amalgam of many different programming languages and styles, including Rust. None of which have anything specific to do with OSX/iOS about them.
At the high-level you are right but on the low-level it's specifically designed to interface with Objective-C APIs which exist in OSes from only one manufacturer. You can't separate Swift from that. The fact that it's an amalgam of OS X specific technology makes it unsuitable for other OSes. It doesn't really have that much in common with Rust either.
False. Cocoa is a significant part of OSX, but there are C api's for most of the frameworks.
> Swift and Objective-C are built for this model specifically.
False.
Swift supports the Objective-C dispatch model only in a special legacy mode for compatibility that must be enabled on a class by class basis. Swift's default dispatch model is static, just like most other compiled languages and has no impedance mismatch with other OSs.
The rest of your argument is based on these false statements and is simply wrong.
I agree that the poor state of GNUStep and indeed the fact that it even tries to be a compatibility layer discourages users.
However objective-c is not tied to GNUStep. And this line of reasoning is irrelevant to swift.
Neither swift nor its standard library are tied to OSX at all. Moreover the applications for which a Linux versions will be useful, i.e. servers, will not be handicapped by the lack of access to Cocoa.
I have access to all kinds of systems, but this is not a consumer item, and it should work everywhere; a mac-only requirement is just as unacceptably limiting for general purpose computing as a windows-only requiremet.
Once it is, I think the reasons explained in this article for using Swift as an introductory language make sense.
Swift is not open source. It might be in the future, and if they do follow through, the release is slated for "later this year." I hope they do, but I also can't blame anyone who decides to wait and see.
By now, 99% of people have forgotten that FaceTime was ever supposed to be more than video calls between Apple devices. I'd hope they won't try and pull the same thing on the developer community who tend to be more in the loop.
I'm not happy with what happened to FaceTime but I don't think Swift is in the same boat. It seems to have the backing of all the relevant parties and shouldn't face any hurdles like the patent stuff that sank FaceTime. And they gave a hard deadline for themselves to stick to. I'm pretty optimistic about it happening.
Pay attention to Chris Lattner and his track record if you want a realistic view of whether the open source promise is likely to be kept for Swift.
That is why people have a hard time believing any Open Source promises made by Apple. And yes I know they have some open source projects available right now.
What would you think if Apple went to announce next Wednesday that the new iPhone will have a sapphire screen, but on launch (after a bunch of people preoder the phone) they announce it's normal glass because a provider couldn't deliver.
Whose fault would that be, the provider's? Apple's? Both?
also, swift has syntax that can bite new developers just like any other language.