2 ms·
Very interesting. I'm surprised that Swift is already expressive enough to support constructs like this. Swift is young enough that it hasn't landed on a parti
by lobster_johnson 12y ago
Very interesting. I'm surprised that Swift is already expressive enough to support constructs like this.
Swift is young enough that it hasn't landed on a particular philosophy yet, and I wonder if it will bend toward ML or more in the direction of Go. For example, protocols and functions currently seem somewhat contradictory; getting the Unicode-compliant length of a string is a function, countElements, not a method, for example.
The fact that Swift is both OO and functional (with generics to boot) means there is an inherent conflict in the language that could lead to multiple styles of using it becoming popular. Witness Ruby's stylistic transformation as it became popular and started trends that now make the old standard library seem antiquated by comparison. Or C++'s transformation through the STL. Or Python's engagement with functional programming (which never really was able to transform it away from its OO origins).
By comparison, Go is simple and inexpressive, so that it's practically impossible to break style; indeed that seems to be core to Go's philosophy.
- tel 12y agoI really would like to practice merging FP and OO together meaningfully in a language. So far, I've been enjoying this in Haskell and I think Swift provides another opportunity. I'm a firm believer that OO and FP are more like two sides of the same coin than real competing interests (in particular, initial v final data types). Unfortunately, I think the strong association of mutability and OO is a detriment and Swift follows it (probably for ObjC compatibility).
- lobster_johnson 12y agoAgreed. I also wish their OO approach would be more like Go or even Ceylon; as it stands, it looks like they took a reasonable base language and merely bolted ObjC's class model onto it, with no unifying philosophy about the language as a whole.
- tel 12y agoYeah, it feels complete but unintegrated. I know a lot of the outstanding Swift tickets are around better integration, but there's a wide gulf.