[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [OT] Swiftly return multiple values
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 3 Jun 2014 12:06:19 +0200
On Mon, Jun 2, 2014 at 10:24 PM, Elias Barrionovo
<elias.tandel@gmail.com> wrote:
> Well, it's a bit OT and nitpicking, but in Python when you do this:
>
> def foo(a, b):
> return a, b
>
> you are actually returning only one value, (a, b), which is an
> instance of tuple [1] (parenthesis is optional for tuple literals).
And that's the point - it's more expensive than it looks. True
multiple returns in Lua and Go are cheap. (In both languages, often
used for distinct error returns)
That's why I prefer Lua to Python - there is less 'convenience magic' happening.
As for Swift - it's fashionable for big companies to have their own
new programming language. A well-known advertising agency [1] has
spawned at least two recently. Despite its oddities, Swift seems a lot
more readable than Objective-C, which always made my eyes bleed.
[1] Google (Go and Dart)