Live data from Hacker News

Apple is rewriting Foundation in Swift

github.com

251–260 of 263 posts

Re: Apple is rewriting Foundation in Swift

#251
post #245
post #242

Earlier quoted context omitted.

It does indeed sound like you have some very old documentation. (as a sibling comment pointed out, swift protocols are typically used for things that in objc you would use inheritance)

Old enough to have enough Objective-C protocols and categories in action. The kind of documentation that inspired Java authors. https://cs.gmu.edu/~sean/stuff/java-objc.html https://en.wikipedia.org/wiki/Portable_Distributed_Objects https://en.wikipedia.org/wiki/Distributed_Objects_Everywhere

Quite a lot has changed in objc since the nextstep days! And a lot more changed as Apple learned from that and built swift. My guess is you don’t know these languages as well as you think if you’re not clear about these differences.

Re: Apple is rewriting Foundation in Swift

#252

Earlier quoted context omitted.

Fast (and principled) inference for not-too-complicated polymorphic types is an explicit design goal for OCaml and Haskell languages. And this design goal constraint quite a lot the type system. Typically, there are many type system features that break this property and where OCaml and Haskell requires type annotations (for instance polymorphic functions that takes polymorphic functions as arguments and use them in a…

Fascinating! Thanks for the insight! Does the up to 60% figure include programs that make heavy use of GADTs, or are those even worse in terms of the proportion of compilation time spent type checking? I had no idea Swift's type checking algorithm is exponential. How easy is it to run into those conditions?

For GADTs heavy programs, it depends a lot on how much work the exhaustiveness check for pattern matching is doing behind the scene: With GADTs, one can encode a Turing machine in the type system. In that pathological case, analyzing that a pattern match is exhaustive might require to check if the encoded Turing machine stops in n steps. Consequently, it is perfectly possible to write programs where the compiler spends 99% of its time on analyzing pattern matching. But it is also possible to write GADTs heavy programs that don't require such expensive analyses.

I have no first-hand experience with Swift but the previous discussion at https://news.ycombinator.com/item?id=12108876 and the description of the problematic algorithm seems to indicate that numerical or mathematical code can run quite easily into the issue.

However, I must add that type inference algorithms being exponential in the source code size is nothing new: OCaml and Haskell inference are also exponential in the source code size. But that is because the size of types can be exponential in the source code size. Moreover, type inference complexity in OCaml and Haskell is linear in the size of types. And since in practice, no one ever uses exponentially growing types, type inference stays well behaved.

The specific issue with Swift is really more that even for simple result types, the inference may still have to do an exponential amount of guess work.

Re: Apple is rewriting Foundation in Swift

#253

Earlier quoted context omitted.

Not sure why the only alternative to Swift is "going back", particularly when Swift is already going back in many ways. How about going forward to an alternative that actually isn't a step back.

Swift is an amazing improvement over objective c and I don’t think there are any languages out there that are obviously superior for the use case. The only people i ever hear complain are objc diehards and general apple haters.

Wrong on all counts.

I can't think of many use cases where Swift is actually better, though I do understand people believe it is. Why is...an interesting phenomenon.

In fact, it is difficult to conceive of a language less suited for the use cases Swift is touted for. See Swift playgrounds. See also: Mojo.

I think Objective-C seriously needs a replacement. Though it got a few fundamental ideas right, the details are almost all in dire need of improvement. Which is why it it is such a shame that the replacement is so unsuitable.

I really don't hate Apple. And my portfolio doesn't hate Apple either.

Re: Apple is rewriting Foundation in Swift

#254
post #190

Earlier quoted context omitted.

Is there an alternative with similar features and ergonomics? I am def. not aware of one.

For which purpose? It depends what you want to do with it.

Well lang features do not really depend on the purpose the 3d party libs do. Let's say the purpose is web services.

Re: Apple is rewriting Foundation in Swift

#255
post #254

Earlier quoted context omitted.

For which purpose? It depends what you want to do with it.

Well lang features do not really depend on the purpose the 3d party libs do. Let's say the purpose is web services.

I doubt the web story in swift is that strong anyways, I'd pick python, ruby or php.

Re: Apple is rewriting Foundation in Swift

#256

Earlier quoted context omitted.

Given karismatic a prize. I wonder if the current state of affairs is what Chris L had in mind?

I don't know, but Chris L was always a C++ guy, he never really understood Objective-C in my opinion, which is why Swift ended up the way it did. I doubt he ever used it very much, or had a deep understanding of it.

I’m pretty sure Chris Lattner has a good grasp of Obj-C, after all they had to design Swift in a way it could easily interface with Obj-C. While Swift went through some versions to become stable, they were always transparent on the roadmap and had a very open attitude towards community proposals. Looking back I think it was a very well executed transition and would consider it a success in every way.

Re: Apple is rewriting Foundation in Swift

#257
post #200
post #182

I might be in the minority here (though, reading the comments, it seems others have the same opinion), but I find Swift to be a step back compared to Objective-C. I really like the verbosity of Objective-C - this makes the code more readable and easier to understand, even (or especially) when reading a program the first time. Being a superset of C (and C++ with Objective-C++) means that, when necessary, one can easil…

>I might be in the minority here I think for sure you're in the minority here. Swift was really a breath of fresh air for my iOS dev work -- it's just so modern and easy to read. That said -- I'm still reluctant on SwiftUI though. Seems like one of those technologies that works great for small apps and tutorials but falls apart at scale but admittedly have little experience with it so perhaps I'd be wise to reserve j…

I’m with you on the SwiftUI skepticism. After 10+ years of native iOS development - can’t believe I’m saying this - but I thoroughly enjoy Flutter, it’s open source I can easily modify anything I want, the tooling is great, VS Code plugin is great, and hot reloading a live app is just amazing. It’s everything SwiftUI should be, let’s see what new stuff they announce at WWDC.

Re: Apple is rewriting Foundation in Swift

#258

Earlier quoted context omitted.

Swift is an amazing improvement over objective c and I don’t think there are any languages out there that are obviously superior for the use case. The only people i ever hear complain are objc diehards and general apple haters.

Wrong on all counts. I can't think of many use cases where Swift is actually better, though I do understand people believe it is. Why is...an interesting phenomenon. In fact, it is difficult to conceive of a language less suited for the use cases Swift is touted for. See Swift playgrounds. See also: Mojo. I think Objective-C seriously needs a replacement. Though it got a few fundamental ideas right, the details are a…

I’ve been using swift full time since 2014, before that i was using objective c full time.

I assure you that swift is a huge improvement for iOS and mac development, and the statistics shoe pretty clearly that this is also the consensus.

Some older developers might be wedded to objc because of old habit, but if you ask 100 developers that are new to apple platforms to choose between the languages, I’d be surprised if even 1 picked objective c.

It would of course be strange if a modern language, developed specifically for use on apple platforms and heavily supported on the framework side, would not be more suitable than an old fashioned language from the 80s.

Not sure what you mean by playgrounds, they are simply amazing and keep getting more powerful. And how does mojo even enter the discussion?

Re: Apple is rewriting Foundation in Swift

#259
post #138

Earlier quoted context omitted.

While it’s true that the language is really only useful on just Apple platforms, it is still quite an amazing language. I have professionally used about half a dozen languages over the last many years, written hundreds of thousands of lines each in all those languages, and swift is a true breath of fresh air. It checks all the boxes for me, very concise and elegant to write, yet very strictly statically typed. A nice…

>Runs reasonably fast, on par with Go or Java. Having to deal with weakself, no reference cycles, very limited closures, having to deal with Xcode, no integration with any other IDE because Apple Apples, debatable generics, SPM, debatable cross platform abilities, fucking Tasks and Actors, SwiftUI being locked to versions of Swift, extremely limited community, few high quality open source libraries for something that…

This comment is of very low quality. I agree with pretty much _nothing_ with it (and tbh most of it feels like trolling), but I’ll just comment on the thing where it’s obviously plainly wrong: no other IDE.

Swift has LSP integration, and has an official extension for VSCode, which works very well. They even have a blog post about it https://www.swift.org/blog/vscode-extension/

Re: Apple is rewriting Foundation in Swift

#260
post #170

Earlier quoted context omitted.

Same, I find swift so much more ergonomic and beautiful than rust, but the development story outside (and inside) of xcode is just ugly

AppCode being sunsetted by Jetbrains made me a little sad. Not coding in the Apple ecosystem anymore. Out of IntelliJ, Visual Studio and XCode, it made the worst impression on me

Swift is fully compatible with Visual Studio for those who prefer it. They have an official extension which works very well https://www.swift.org/blog/vscode-extension/

(Also, it’s Xcode)

Post reply on HN