I hate to say this, but Swift is to Objective-c, what Scala is to Java.... It was very exiting and promising at first, but it became bogged down due to its sheer run-away complexity and over-academic approach to programming.... To an outsider, or iOS new comer, Swift looks much better than Objective-c, (due to Objective-c weird syntax), but to many insiders, Swift seems like a huge missed opportunity... The use of Sw…
The Decade of Swift
21–30 of 145 posts
Re: The Decade of Swift
#22> That’s why Swift’s expressive and very lightweight syntax And a few paragraphs later: extension Array { func sorted ( by keyPath: KeyPath ) -> Self { sorted { $0[keyPath: keyPath] I can't say this is lightweight any longer. My greatest gripe with Swift comes not from Swift itself but from its standard library. When most new languages start with their own standard libraries that are usually interfaces towards C APIs…
Swift optimizes for lightness at the call site, but even the definition is quite short for the constraints it imposes.
> I recently needed to read some data from a file in Swift, and it took me quite some time to realise there was no fopen equivalent.
You can import Darwin or Glibc to get direct access to fopen. It’s a bit unergonomic to use, though.
> Read/write files is a function on String?
NSString, as a deprecated holdover from Foundation.
> There are a few other weird things in the language itself like guards which IMO are an entirely unnecessary construct that can be as easily solved with regular ifs.
That’s the whole point of syntactic sugar and constructs which make your intent clear.
> Or Optionals that have no way of working with them except unwrapping them (either with ! or via guards).
There’s also the nil-coalescing operator, but the whole point is that you can’t sweep an Optional under the rug.
Re: The Decade of Swift
#23> That’s why Swift’s expressive and very lightweight syntax And a few paragraphs later: extension Array { func sorted ( by keyPath: KeyPath ) -> Self { sorted { $0[keyPath: keyPath] I can't say this is lightweight any longer. My greatest gripe with Swift comes not from Swift itself but from its standard library. When most new languages start with their own standard libraries that are usually interfaces towards C APIs…
It's not that complicated once you look it up, and like most of this stuff, you can mostly write wrapper classes one time to hide the gnarly bits and call your wrapper class to do what you need to do the way you like to do it.
It's been several years since I've had it read from a file, and I actually thought I would click that twitter link and see something super complicated, but it's actually pretty straight-forward. Not a one-liner like some languages, no, but as soon as you want to open something with options (like the encoding in this one), most other languages start looking more complicated like this as well.
Like python's open looks more like this with options: "open(filename, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)". I've opened many a file in Python scripts, but I'd have to look up buffering, encoding, errors, closefd, and opener right now if I wanted to use them (I haven't really in the past)
And Python has 11 different access modes that I often have to look up to remember what all my options are again: r+,w,wb,w+,wb+,a,ab,a+, and ab+
Re: The Decade of Swift
#24Objective-C is simply regular C with Smalltalk objects added. If you know Smalltalk and you know C then you're golden.
Re: The Decade of Swift
#25I can't really imagine Swift ever breaking out of Apple's walled garden. It's a pretty big garden, but the language concedes so much to Objective-C compatibility, it is hard to see any role for it where Objective-C never got a foothold. Where am I wrong?
Re: The Decade of Swift
#26I can't really imagine Swift ever breaking out of Apple's walled garden. It's a pretty big garden, but the language concedes so much to Objective-C compatibility, it is hard to see any role for it where Objective-C never got a foothold. Where am I wrong?
Re: The Decade of Swift
#27Re: The Decade of Swift
#28With Chris Lattner's move to Google and the state of Java it would interesting to see Google embrace Swift and add official support for it to Android.
This seems very unlikely to me. They would need it to interoperate with their existing stack. They chose Kotlin where they reasonably could have chosen Swift and then worked to extend it to work with their existing stack. Judging by what I would argue has been a lukewarm reception to Swift for Tensorflow, I think it would a very hard sell to convince people within Google to support Swift as a first-class language in…
Swift for Tensorflow hasn't gotten much traction because the overlap between programmers who know swift and machine learning engineers is super tiny. Making the core language differentiable sounds very promising though .
Re: The Decade of Swift
#29Swift has come a long way. I remember first trying it and XCode acting like it couldn't figure anything out in Swift, and you could almost never bring up an autocomplete or search for references or jump to definitions or any nice feature in an IDE that worked just fine with Objective-C. I decided to give it another shot years later, and I'm working on a simple game in Swift right now, and it's been a much, much smoot…
Re: The Decade of Swift
#30With Chris Lattner's move to Google and the state of Java it would interesting to see Google embrace Swift and add official support for it to Android.
This seems very unlikely to me. They would need it to interoperate with their existing stack. They chose Kotlin where they reasonably could have chosen Swift and then worked to extend it to work with their existing stack. Judging by what I would argue has been a lukewarm reception to Swift for Tensorflow, I think it would a very hard sell to convince people within Google to support Swift as a first-class language in…