I saw the following Swift example on this page:
func jediGreet(name: String, ability: String) -> (farewell: String, words: String) {
return ("Good bye, \(name)", " May the \(ability) be with you.")
}
An equivalent version in Go is as follows:
func jediGreet(name string, ability string) (farewell string, words string) {
return "Good bye, " + name, " May the " + ability + " be with you."
}
Notable differences include:
:
and the ->
.(
and )
.This Q/A explained the reason that Swift needs :
, but still, it looks like that ->
and ( )
are redundant.
Do they really unnecessary? If so, is it because of some intellectual issues so that Apple cannot adopt a concise syntax as Go already has?
[Yes, I noticed that the second line of the Go version is actually longer than the second line of the Swift version. Thanks to the \(param)
syntax of Swift. I love it.]
--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swift-languag...@googlegroups.com.
To post to this group, send email to swift-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/8733225a-127f-48c2-97dd-50749bd52b83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Dec 19, 2014, at 2:21 AM, Jeremy Pereira <jeremy.j...@googlemail.com> wrote:Why the obsession with the fewest possible keystrokes?
--