[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [OT] Swiftly return multiple values
- From: Tim Hill <drtimhill@...>
- Date: Tue, 3 Jun 2014 09:59:58 -0700
On Jun 3, 2014, at 3:06 AM, steve donovan <firstname.lastname@example.org> wrote:
> On Mon, Jun 2, 2014 at 10:24 PM, Elias Barrionovo
> <email@example.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  (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  has
> spawned at least two recently. Despite its oddities, Swift seems a lot
> more readable than Objective-C, which always made my eyes bleed.
>  Google (Go and Dart)
Agreed .. compared to Obj-C it seems a step forward. Overall it’s not too bad, though I detect a distant echo of Pascal in there somewhere (variable declaration syntax for example). I would place it ahead of C++ and Java to be honest (damned with faint praise??). I’ve never enjoyed coding in C++, I can see myself being ok with Swift, though it will never be as elegant as Lua. At least it has a clean set of integer types (i always disliked the mess called stdint.h).
It’s interesting to see how some of the features reflect characteristics of LLVM (the use of “let” constants for example to help the code generator with optimizations).