- Why does Swift have both a "var" keyword and a "let" keyword? One should be sufficient with the other being a default behavior. If a symbol is not declared "var" then just assume it is constant or visa versa. Furthermore, it may not be necessary to have either of the key words because (I think) in every case, the need for variability and mutation should be determinable by the compiler. Type is already being inferred by the compiler, and mutability could reasonably be considered an aspect of type.
Having to use a keyword to introduce a new symbol is a pretty critical reliability feature. If there's no keyword to say "I want to define a variable", then every typo creates a new variable, rather than a compiler error. Lots of scripting languages work this way, and it's hell on reliability.
- Why are Swift collection types like Data always mutable? What happened to the concept of immutable containers from Cocoa. [Yes, I know the "bridged" CF types are always mutable, but that was another bad decision IMHO.]
They're not. That's why you have "var" and "let" keywords. You use "let" for constants, and "var" for mutable objects.
- Swift is intended to be a "Systems Programming Language", is it not? Yet, there is no support for "volatile" variables needed to support fundamental "system" features like direct memory access from peripheral hardware.
"Systems programming" != "device driver development". Nothing above the driver level should be accessing hardware directly, so that's a feature that could likely wait until every other Swift use-case has been addressed.
- Having experienced frustration trying to port high performance graphics code from C/C++/Objective C to Swift, what's up with that? IMHO, Apple's sample code for using OpenGL/GLKit/Metal from Swift leaves the impression that Swift is unsuited to the style of "low level" programming needed/used by OpenGL/GLKit/Metal.
Not sure what the actual complaint is here. Can you give an example of something that's particularly difficult?
- Why not support "dynamic runtime features" like the ones provided by the Objective-C language and runtime? It's partly a trick question because Swift is remarkably "dynamic" through use of closures and other features, but why not go "all the way?"
Part of the goal of Swift is to use compiler "smarts" to generate performant code. You can't really do much in the way of optimizations for dynamic dispatch, so it's not the preferred method. The bindings are there to talk to Objective-C, but Swift-native code is expected to solve those problems another way.
- Finally, a trivial aesthetic critique: Why "var foo : typename" like Ada and Pascal (IIRC) instead of "var typename foo" like every language that inherited C style syntax? Is there an advantage to the Swift approach that I haven't seen, or was it just an aesthetic choice? Did the choice not produce some IMHO "silly" syntax for method declarations with named parameters?
As far as I know, it's purely aesthetic. It's worth noting that type declarations are optional fairly often in Swift, so perhaps it was a decision to try to make the appearance of types less "jarring" where they *do* need to show up.