5 ms·
Obligatory comparison: https://leverich.github.io/swiftislikescala/ https://leverich.github.io/swiftislikescala/
by desdiv 10y ago
Obligatory comparison: https://leverich.github.io/swiftislikescala/ https://leverich.github.io/swiftislikescala/
- tormeh 10y agoWow. They're basically identical. Scala has a bit less boilerplate sometimes, but it's also older, so I guess Swift will get syntactical sugar to catch up in time.
- melling 10y agoNo, it's a lot like Groovy: http://glaforge.appspot.com/article/apple-s-swift-programming-language-inspired-by-groovy http://glaforge.appspot.com/article/apple-s-swift-programmin... No, it's a lot like C#: http://swiftcomparsion.qiniudn.com http://swiftcomparsion.qiniudn.com
- vorg 10y agoNeither Scala nor Apache Groovy are listed in the 8 languages Swift was influenced by on its Wikipedia page. That Groovy link was written by the Apache's Groovy PMC chairperson, and is more wishful thinking that fact.
- melling 10y agoYeah, I already knew what Wikipedia said. My point was that a lot of languages look similar. Scala might have influenced Swift. Zip you go to the author's blog, he says lists those languages and says many more that he doesn't name: http://nondot.org/sabre/ http://nondot.org/sabre/
- chris_7 10y agoSome of these comparisons aren't great. The "Variable Number Of Arguments" example is better expressed in Swift with "reduce", and it's really comparing "summing an array", the varargs aspect is a minor detail of the example. The "Idiomatic Scala" example doesn't even declare a function with varargs! (yes, it uses one, but that's not really the point) The Swift function in the protocols example doesn't need to be generic, as the protocol doesn't have any associated types, and really ought to be a protocol extension regardless.
- yvsong 10y agoThe comparison should be updated to Swift 3. Swift syntax is more intuitive and readable than Scala. A common mistake in language design is to depart from C syntax, without substantial gain. For example, replacing {}, &&, || with other things. Swift strikes a great balance between intuition and innovation.
- premium-concern 10y ago> Swift syntax is more intuitive and readable than Scala Example?
- manojlds 10y agoAnd scala doesn't have {}, &&, || ?