Earlier quoted context omitted.
Idiomatic Swift is primarily protocol-based, object-orientation is mostly used when talking to the Cocoa frameworks, which aren't idiomatic Swift code. But the main problem with subclassing is: https://en.wikipedia.org/wiki/Fragile_base_class
Objective-C (and Swift) don't have the fragile base class problem: http://www.sealiesoftware.com/blog/archive/2009/01/27/objc_e...
Swift: Things I really wanted that won’t make it
51–54 of 54 posts
Re: Swift: Things I really wanted that won’t make it
#52Earlier quoted context omitted.
> "functional" (which means it has immutable values I guess?) No, it means that it's a functional language. Please consult google if you are not sure what that means. > "pretty good type system" (which means it has generics?) No, it means that it has a more advanced type system than any of the languages you mentioned. It's most likely the most popular language with a type system that can be considered somewhat advanc…
It's not a functional language: http://robnapier.net/swift-is-not-functional Please inform me what Swift's type system has over, say, Java as I don't know of anything and neither does a cursory Google. The lack of an HTTP server is only an example. Let's see you parse JSON, or stream a Unix socket, or any of countless basic things that even Node includes in its standard lib. Swift doesn't really have much of anything…
One way that Swift's type system is more advanced than Java is the ability to define extensions to protocols (interfaces) constrained to specific types, i.e. you can add "average" to "SequenceType where Generator.Element == Double". You can also use this to provide default implementations for protocols, but only in the case of specific associated types.
Re: Swift: Things I really wanted that won’t make it
#53Swift is not perfect but I've been writing it a bunch recently and it's hands down one of the most productive languages I've written in. Fundamentally I believe that it might be one of the most important languages because it's relatively close to the metal, it's a 'modern language' (i.e. functional, has a pretty good type system), open source, and a major company and platform behind it. I think that if Swift 4.0 adds…
And you gotta love the Swift REPL :)
Re: Swift: Things I really wanted that won’t make it
#54Earlier quoted context omitted.
I don't have any experience with Swift, but how to you approach unit testing with everything `final`? Being able to inject mock subclasses is a staple of OO testing.
I don't know Swift, but I know I testing... your constructors should be accepting interfaces (for things that are complex enough that you'd want to mock them), not concrete types. In Swift I gather you'd use protocols.