559 points · by rayx2022 · 4y ago · 487 comments
As someone who was heavily invested in Swift, and an active member of the community from around 2015-2019, I'm a bit sad to see the direction the language is taking.
From the time I started experimenting with Swift, I absolutely loved the philosophy of the language. It seemed to really prioritize having a set of well-factored systems, each with their own very rationally designed interfaces, which could be composed to do really powerful things. It was an incredibly expressive language which allowed for writing code with an incredible level of clarity - when writing Swift code I always felt I was writing at the level of the problem domain, not writing syntax. At the same time it offered really nice features for ensuring safety and correctness, like ADT's and best-in-class nullability syntax.
It was a language which sometimes seemed to move at a glacial pace, but the implicit tradeoff was that when a feature landed, it was for the most part very well thought out, and would add to the language with minimal negative impact.
A few years ago that seemed to start to change. From my perspective, some of the features added to the language to support SwiftUI - specifically property wrappers and function builders - very much felt rushed and forced into the language based on external deadlines. And imo they have a largely negative impact on the language: it used to be the case that you could look at a piece of Swift code and roughly understand how it would compile to assembly pretty easily, but with these new features there's a ton of compiler magic going on behind the scenes.
This happens with all corporate software, as people compete to (for instance) foist their new videoconference system into your calendar flow. That's sort of tolerable for end-user software, but horrible for programming languages where feature-feature interactions grow as N^2.
One notable remaining exception to this trend is Go. They are committed to the "simplicity" mantra and so far they have stuck to carefully weighing and discussing any feature added to the language. I know that some consider it too simple and the "glacial" pace of development not exciting enough, but I personally appreciate it...
Apple it seems does well w/ a Scott Forstal or a Bertrand Serlet running cover for their engineers. maybe not so much if there's a giant committtee....
Committees work when they have a shared vision, and a base strong enough to keep them on that path.
It’s clear from Lattner’s statement that Apple have moved that vision, have not brought the group along with that change and the result is wasted effort and a passive aggressive approach.
I would posit that rather than operate as a committee, instead that leadership is being exercised by a limited few and the structure is being retained as a fig-leaf :(
You can call it a moot point since the amount of what you can do in pure C today is very limited - you have to use at least a few libraries to do anything remotely useful even on very light systems, but in today's fast developing tech world it's one of these things that really stand out.
There's just so much prior art out there.
You might find this an interesting perspective:
Having a core language helps a lot too. E.g. I don't expect Rust to go off the rails.
For instance sync rust is mostly nice to work with, but async is another story entirely. I have the impression that it was somewhat rushed into the language due to community demand, but it's not really a fully solved problem.
Unless the rails are too rusty :-)
You would have 2 lines of code per property but one fewer concept—and I think that is a much more important factor. To me—this was not the right way to add sugar.
When I started, I thought it would be some complicated beast, but no - its a reasonably simple and elegant C superset with the only disadvantage of some extra verbosity. (but Apple API's suffer from verbosity as a principle)
I have to wonder: why did Apple create Swift ? Objective-C is quite nice, especially for C/C++ programmers. With Objective-C++, interop with C++ libraries is also terrific. Swift offers nothing like this yet.
Because a dependent type is a type that represents a computation. A word that symbolises a computation, a word which can be manipulated by hand and assured by machine – and vice versa.
Software is automation. Types are signifiers of meaning. Dependent types are the automation of the automation.
Using a dependently-typed language feels like handling a machine which is the result of having closed a fundamental loop of expression vs. meaning. And that is what it is.
It’s very philosophical-sounding! It has its roots in philosophy – in intuitionism, where math dug down and met philosophers who had dug down from the other side. Kind of.
Practically, the upshot is that things actually become simpler. Kind of because you can grip the tool everywhere. Un-dependently typed languages feel kind of like they’re part tool, part void. You usually can’t express things relating the context you’re in, or looking at.
> Software is automation.
software is a lot more than just automationWider question: How can a language and its core library stand still? To me, standing still is death for any computer programming language ecosystem. Many languages are just getting started on the idea of "green threads" and "colours" (sync vs async). Some of this can be done purely with a core library using existing language features, but some evolutions are better done with language features.
I would almost never write C++ (in the context of low level and performance-relevant code; I write a lot of things for a lot of stuff) if the type system was a touch more rigorous (why can't I specify, and have the compiler yell at me if I don't properly handle, "this pointer may never be null"? TypeScript can do this kind of type narrowing in its sleep!) and if error handling/lifecycle cleanup wasn't hazardous (I'm not even saying exceptions and try-catch, just make it easier to guarantee that a cleanup clause gets called when leaving scope, like Ruby's def-ensure-end).
As it is, whenever I finally hit the breaking point with C++ (which I write mostly from inertia because I know it pretty well) it's probably Rust for me.
C23 is about to
- add keywords that was valid identifiers before
- remove K&R parameter syntax
- change semantics of the most popular function argument list declaration
- forbid representations other than 2's complement
A good deal of bad code design comes down to not being able to predict what a bit of code is going to do without stopping everything, unrolling whatever built up state you had in your mind (from the thing you were actually trying to do) and sit and become one with the code for a time. But at least when you’re unsure what the code is doing you have a suspicion that is the case. The worse sin by far is misdirecting you into thinking it does one thing when it does something else, or even the opposite.
We like to complain about extroverted business people interrupting us, but we seem to have very little guilt about doing it to each other by leaving these sorts of time bombs in our code.
For all the critique of java, I think this is the one thing java got correct. It is (no matter how verbose or clunky) still easy to read and understand.
Of course one can't make them understand as they are just following "best practices" enforced at employers.
Could you give an example for your point?
The best part was the perfect C/C++ interop. When I was working on iOS apps in Objective C, I found myself writing a lot of pure functional code using C and it was pretty neat to be able to integrate that with the OO stuff from Obj C so easily and with a clear dividing line.
I think that this comment was written with a positive spirit, but that quote-chopping is incredibly meaning-distorting in a way that counters your point. The original poster stated that Swift "used to be the case that you could look at a piece of Swift code and roughly understand how it would compile to assembly pretty easily" -- you chopped after "understand". There are very few languages where it's /harder/ to understand how they compile to assembly than Java. The JIT compilers are both incredibly complex and incredibly varied, and almost all of them have multiple possible compilation outputs for the same code.
Java, as a language, has been relatively successful in making it easy to understand programmer intention when reading code, as your chopped quote implied -- but the same could be said of Python, Julia, and plenty of others. Swift is in the much smaller category of languages where you can understand how the code will /run/ -- along with C, etc. One could argue that Swift's greatest virtue is that it falls into both categories, but that's another discussion.
Not many people these days can read and fully understand the 64-bit assembly code generated by llvm. I think it is less than 1% of Mac developers.
C++ also have a lot of magic going on. Even C can be tricky with an optimizing compiler.
Yep. If anyone had doubts that the language was no longer the one Lattner designed, SwiftUI should've put the nail in that coffin.
Swift is an imperative, statement-oriented, language. In fact, I get kind of frustrated when writing Swift after spending some time with Rust: I just love writing `let x = if foo { 1 } else { 2 }` or `let x = match foo { ... }`, and it's ugly as hell to try to assign a variable from a switch statement in Swift, etc. BUT, that's okay- I'm almost sure that zero programming languages were written with my opinion in mind, and Swift is Swift.
But, SwiftUI is declarative, which just doesn't work with literally the entire rest of the language. So they added result builders and these weird, magical, annotations just so we can have a UI DSL.
Error handling is now inconsistent and annoying, too. The original approach was to use this quasi-checked-exception syntax where you mark a function as `throws`, and all callers are forced to handle the possibility of failure. The difference between this and Java's checked exceptions is that the specific error type is not part of the signature and therefore the caller only knows that they might get an Error, but not what specific type of Error.
They even have a mechanism for higher-order functions to indicate that they don't throw any of their own errors, but will re-throw errors thrown by function arguments. Clever.
Okay, fine. Pros and cons to that approach, some like it, some don't, etc, whatever. Except then they realized that this approach falls flat in some scenarios (async/promises), so we really just need to go back to returning error values. So they stabilized a Result type.
So, now we need to figure out when we're writing a function if we want to return a Result or make it throw. And, even more annoyingly, Result has a specifically-typed error variant! It's actually a Result<T, E>. Which is it, Swift team? Should immediate callers care about specific error types or not?
Just recently, they landed the async and Actors stuff. Async is fine and great, and is consistent with the imperative syntax and semantics of the language, and it even supports `throws`, IIRC. But Actors? What the hell is that? That's totally out of left field for the rest of the language.
I used to really enjoy Swift in the 2.x to 3.y days, but it really seems like it doesn't even know what it wants to be as a language anymore, which is a real shame- it had a real shot to take the wind out of Rust's sails, IMO (The number one "scary" part of Rust is lifetimes and borrow checker. Swift has CoW structs and auto-ref-counted classes, instead, which can be seen as more appropriate for higher level tasks than writing system libs, etc).
I think the main issue with GCD is the potential for deadlocks in serial queues (which it doesn’t really help you with), and the related problem of thread explosion in concurrent queues.
Actors make protecting shared mutable state really easy, solving a big chunk of the reason you’d want to use semaphores and serial queues in the first place. If you stick with async/await/Task{}/actors, you’re guaranteed to only have the optimum number of threads that can saturate cores, and won’t have deadlocks. If you use Sendable properly and heed all the warnings, you’re a good way towards the kind of “fearless concurrency” that Rust gives you. It really is pretty great IMO compared to GCD.
That said, I'm really not sold on actors. I think CS as a whole hasn't really landed on the right abstraction for concurrency yet, actors seem a bit experimental, and GCD is plenty good enough in most cases.
But I think it's over-sold as a systems/low-level language. Relying on ARC for all reference types creates a significant floor in terms of performance which makes it unsuitable for a lot of systems programming applications - unless you resort to unsafe Swift, in which case you're not really writing Swift.
What do you think the ratio between people who want to understand what the assembly will look like, to people who want a simple and powerful way to write apps? I think it's very close to 0.
>After several discussions generating more heat than light, when my formal proposal review comments and concerns were ignored by the unilateral accepts, and the general challenges with transparency working with core team, I decided that my effort was triggering the same friction with the same people, and thus I was just wasting my time.
I stopped paying attention to Swift for this exact reason. I have actually submitted and implemented a feature in Swift and I think it was one of my most frustrating experiences with open-source projects. It seems that almost every thread in this forum devolves into people fighting over the most irrelevant details, and my proposal specifically took months to be submitted into review because a couple of users simply refused to back down from how they personally wanted it to work, ignoring the actual problem the feature aimed to solve. After a long time deflecting the comments, the feature was accepted the way I originally intended and I never entered the forum again.
Example aside, it doesn't take a proposal to see that almost every thread in the forum looks like this. Open sourcing Swift has benefits, but I think when it comes to the actual progress of the project, this particular democratic process was a mistake.
(I wouldn't count C as actively developing, even though it is moving glacially slow, I'm thinking of things like Python, etc. Or other languages that aren't "done.")
Apple's marketing around Swift advertises the "open source" aspect, and there's a lot of money to be made making iOS apps, so there's naturally going to be a lot of noise around proposals/developments.
Mozilla has a long tradition of "open source" that Apple does not. So Mozilla were able to cultivate a community around Rust, where Apple laid down a lot of astroturf...
I like swift enough I’m learning it to build my own personal tech nerd ideal podcast client because I own apple devices and want an app that works between macOS, iOS, iPadOS, tvOS,and watchOS. but I doubt I’ll ever use it for anything beyond this one personally motivated project. Even if i release it as an app on the store for download or purchase I don’t know if I will ever be motivated enough to build anything else using it. Because the scope is too narrow. Business work is converging on open stacks like react, and angular, and the dark horse of C# with its latest release supporting WASM web components backed by GRPC-web and a C# function driven stack from front to back, even without SQL Server costs this is a compelling ecosystem backed by PostgreSQL and other completely open source tools.
But Swift remains Apple’s language for apple stuff and… while a profitable niche, it’s still a niche.
Edit: typo fix.
No matter how much apple market share in whatever market grows, developers want to be able to switch platforms and not have to think about the language.
Objective-C has served them for over 40 years, building several different OSes over a multitude of CPUS and platforms.
If anything, Swift would welcome a repeat of this history.
That alone does not make it good.
The primary goal should be to maximize value, and within that a balanced tension between maximizing delivered value vs maximizing captured value. It's reasonable to be compensated for the value you add, but it needs to be in service of maximizing value in general. If the correct hierarchy of goals is inverted and capturing value becomes the primary aim then it inevitably devolves into this antisocial, monopolistic, lock-in behavior.
It would have been much more productive to team up with the C# team as C# is a mature language, and a combined Apple + Microsoft would have been able to compete against java (esp. with Oracle as owner of java).
Obviously iOS platforms are much less constrained today, but not having to run a GC is a pretty nice thing.
Maybe C# could've been extended into that universe (I know Midori had their own variant but don't know much about it) but it seems daunting to then make that compatible.
The modern GC in java is amazingly fast and with a few tricks likely to be good enough.
If you scroll to the top of the page with Chris' comment, this point is being addressed:
>In the coming weeks, we hope to introduce a new language workgroup that will focus on the core of the language evolution itself, splitting off this responsibility from the core steering of the project. The intent is to free the core team to invest more in overall project stewardship and create a larger language workgroup that can incorporate more community members in language decisions.
C touches much more than telephony
Oof. Yeah, that’s relatable. It’s hard to continue contributing volunteer efforts to projects you care about when you’re getting shouted at all the time.
So maybe one the problems is that at this point, he's no longer getting the deference from other community members that he feels he's still owed?
> For context, I left Apple over five years ago and the only constant in my life is that I'm always "very busy" :smile:. That said, Swift is important to me, so I've been happy to spend a significant amount of time to help improve and steer it. This included the ~weekly core team meetings (initially in person, then over WebEx), but also many hours reading and responding to Swift Evolution, and personally driving/writing/iterating many Evolution Proposals 19. As such, my decision to leave the core team last summer wasn't easy.
Call it Bird or Goose or something.
Pull out SwiftUI and keep it simple. Focus on the server market more.
I don't really know what Apple can do per se to turn this ship around, but Swift "as a brand" has definitely lost its luster. I'd considered wading back into Apple app development when SwiftUI was first introduced (at the time I hadn't touched any of the dev tools since early-era Mac OS X Cocoa/Objective-C), but I have no interest at this point. (The App Store being a real s**show also doesn't help matters!)
This puts a bullet in my hopes for Swift. Why on earth would Apple not support this obvious A-Team player?
Yup, hot take: SwiftUI is hot garbage.
Declarative rendering is the worst rendering: it's code written that doesn't have to be written. The beautiful thing about UIKit, NSLayout, and Storyboards, is that when used effectively, not much UI code has to be written, and when it does, it matters.
Now everything has to be written to hells end. And not only do I need a mental diagram of my UI in rendered state, I need it in code state as well.
If someone could enlighten me, I would gladly take the lesson.
Edit: I'm very happy I posted this to learn. I used UITextViews extensively in my only app development, and was extremely frustrated with SwiftUIs readiness on that front.
That said, I still like that my code can reflect the 'flow of thought' rather than the strictness of the UI when developing. I guess a lot of the property wrappers got to me too
And all the improvements given to declarative rendering could be embodied in updates to Storyboards and the like.
The only comparable thing in UIKit is UIStackView. In fact, UIStackView was clearly added to reduce the explicit constraint layout code required for simple layouts. While you don't "write" UI code with Storyboards, it's certainly there, just encoded into a non human readable format.
SwiftUI has many problems (mainly bugginess and missing APIs) but I don't see how the old APIs required "not much UI code ... to be written". If anything, this is one of the primary benefits of SwiftUI: getting to remove most of the explicit layout code and complex type system required to do basic layout tasks with UIKit or AppKit.
Also I think the decision to make combine a core building block of Apple UI development is a huge mistake. FRP is a plague on the industry, and everyone is going to figure that out in a couple years.
The syntax is incomprehensible and inconsistent, the documentation is ridiculous, the feature set is severly lacking, and worst of all it's unbelievably slow. I have the fastest processor that Apple sells and a proof-of-concept app that I made in a few hours that consists of three Swift files takes 30 seconds to compile. I can't imagine what building non-trivial apps with it wouldbe like.
Instead of the native app world, I stuck to web front ends and managed that awkward transition from jQuery to Angular to React. These models for UI made increasing amounts of sense — instead of fiddling with weird lines a slop gui, I could just tell the system what I want and get it!
Then SwiftUI came along, and lo, I get all the goodness of React in iOS and even MacOS! My first native app in years is coming along swimmingly, and it’s even cross platform!
(yes, I did do an app in React Native, and found it gross for reasons that I can’t put my finger on)
What you are referring to with UIKit, NSLayout, and Storyboards is in fact declarative rendering, but the layout code can only be modified with a point and click editor. In most people's opinions, editing code directly is much more controllable and works better for systems like Git.
The criticisms I’ve heard of SwiftUI come from a guy who absolutely loved React. I think the problems are unrelated to the overall idea of declarative rendering being flawed.
What do you mean? You can build desktop Windows WPF or Winforms apps with the new .NET. There's also MAUI for cross-platform desktop apps.
What would have been ".NET Core 5" is just ".NET 5", and that's when the bulk of the desktop framework compat came online.
Microsoft <3 Linux
There's two sides to every story?
There are some exceptionally capable people who simply cannot work together on the same idea/problem in my experience. This doesn't necessarily mean that one or the other is inherently bad.
So overall things balance out even if not big win for either.
Swift: Close process + big funding -> fast implementation / less feedback Rust: Open process + little funding -> slow implementation / lot of feedback
Also even with lot of feedback many community members in Rust are already claiming very new features like Async in Rust are deficient in parts and feels rushed.
>Go has community contributions but it is not a community project. It is Google's project. This is an unarguable thing, whether you consider it to be good or bad, and it has effects that we need to accept. For example, if you want some significant thing to be accepted into Go, working to build consensus in the community is far less important than persuading the Go core team.
https://utcc.utoronto.ca/~cks/space/blog/programming/GoIsGoo...
I think this comes down to Chris being a very busy person who has better things to do with his time than argue about the direction of a project he no longer controls.
It's too bad Swift is straying from his original vision but that's the tradeoff of designing a new language with a large company. Not blaming Apple or anything, kudos for them putting so many resources in an experimental new language, and LLVM wouldn't be where it is today without them (which I think is enabling a sea change in engineering), but at the end of the day there's only one use case for swift that matters.
Sometimes organizations just grow to be too large and too remote to sustain a productive and respectful environment. I don't think anyone is necessarily at fault here.
Seems incredibly disrespectful.
Seems to me to probably reflect a high degree of insecurity: if you're not secure and feel the need to protect your position I can imagine some people reacting this way if Chris is telling everyone he thinks your idea is a bad one.
Not sure if Apple silo-ing off teams lets this perpetuate, but then again, it's not like Google or FB have their own share of toxic groups.
You'd think something like that whole Apple university MBA program would figure out better ways of managing large numbers of people with commensurate egos, but it seems like an unsolved problem.
Playing devil's advocate here, but we should hear the same history from the other side, more so if these "insulting and yelling" happened more than once with different team members.
I don't know any details to question legitimacy of the issue, however in my experience I am constantly surprised how many times it is just communication breakdown or gap in what each party perceives.
Also the pandemic has made things more stressful for everyone and outbursts do happen with more frequency perhaps it is easier virtually to shout at some one i suppose.
Torvalds was known for his infamous roasts on LKML, he only goes on a triade when he feels the situation warrants and person should know better. That doesn't make it right , but someone had to really explain it to him before he toned it down recently. I don't think his intent was ever to be toxic or aggressive.
Effectively communicating problems can be hard.
Just sounds to me like he felt like he was wasting his time.
Engineers letting technical disagreements turn personal.
And Chris himself said he disagreed with the technical direction of the project.
In any event though not good.
It's also possible that there are people who feel that yelling is an acceptable part of debate.
Misguided people, sure, but they do exist.
Apple's management culture is they're basically running an army of orcs. Anyone who threatens the authority of the mid-level bureaucrats - they'll sic the orcs at you.
And since he's not naming names, he's being professional about it, but pointing out that the bad behavior isn't for him.
It is about as good as a response that can be considered, given the circumstances.
In my own experience… Apple is a large company, with a huge variety of teams with different accepted standards of conduct.
But the Swift language is also an open source project, so this is a pseudo-open dev community so I’m not sure if Apple’s internal corporate culture even has a strong hold over this mailing list and those WebEx meetings that probably include volunteers, not just Apple employees.
Just FYI, you want:
> It is about as good a response as can be considered
(Incidentally, I couldn't agree more with your comment. It was a very magnanimous response that he gave.)
So in practice, yeah you leave.
That said you are right; you should also raise the issue to upper management. You have more options than just speaking to them directly.
I do wonder how many people prefer Obj-C to Swift. Philosophically speaking, Chris Lattner's ideal of Swift could replace PL from Javascript to C, while a noble goal was a big no no for me. I often think Swift is an unnecessary distraction in the overall Apple ecosystem.
And I do notice programming language design and usage tends to get very heated in discussions. And there is a growing charm in ugly language ( so to speak ) that shuts up and get the job done.
But a disagreement is one thing, being shouted at during an online video meeting? That is some level of aggression. Although there is always two side of the story.
Sorry to hear about Chris Lattner's woes with Swift team. I only know of his reputation so I'm confident he will find a new, happy and appreciative, home for his talent.
It sucks that we keep enabling abusers. I don't begrudge Mr. Lattner his decision, but why should he be the one to have to leave?
Perhaps Chris is letting bygons be bygons, and going bye-gone?
(Part of sticking up for his team means pushing back against idiocy in the upper tiers of management, which isn't always popular!)
I do not see an obvious solution to this other the somewhat untenable goal of restricting discussions to email only.
To me, as an outsider, the only interesting question remaining is, what ideas, if any, from Swift are good enough to adopt into other languages that seem to have legs?
More interested in what good ideas we might be able to take from Swift.
Not that it's wrong or that it can't possibly work, it's just not how Apple rolls.
If not Lattner, what figure or faction is now in control of steering the future of the language?
> As mentioned earlier, releases was the last planned feature for Elixir. We don’t have any major user-facing feature in the works nor planned. I know for certain some will consider this fact the most excing part of this announcement! [0]
[0] https://elixir-lang.org/blog/2019/06/24/elixir-v1-9-0-releas...
https://news.ycombinator.com/item?id=27782864
It's definitely an unusual approach for authors to consider software "done", and Clojure apparently gets close to it (?)
Not surprisingly, that kind of stance also generates controversy ... you can't win :)
On the other hand, it also shows some of the disadvantages - for example, there is no multi-threading support of any kind in the Common Lisp standard, because this was not a common feature at the time the standard was created; neither is there Unicode support. Of course there are libraries that implement these things, even portably (and this being CL, the difference between library and core langauge is minimal), but it's still a point some hold against it.
Though I'm on the fence, that they end run around the pressure to evolve, by just inventing new DSLs via gobs of macro magic for some of the newer stuff. Whereas a language like Swift keeps leaning on the compiler to respond to evolving demands.
And at the end if the language is inadequate for something then simply use something else that fits better, there is no reason to force all languages be gigantic kitchensinks.
I was deeply disappointed a few years ago when the TensorFlow in Swift project was scrapped.
That project had a ton of potential, but it seems like it lacked buy-in from the industry, and the team working on it seemed to lack leadership as little progress ever seemed to get made.
Here is a real method signature under Swift:
public func index<Elements: Collection, Element>(of element: Element, in collection: Elements) -> Elements.Index? where Elements.Element == Element, Element: Equatable {
// Function body got is here
}It looks like you are doing SQL statement in just a method signature, which is just insane.
The Swift Team really needs to take a step back, and actually start removing features and simplifying the language drastically if they want it to succeed. At his point there is a great chance that Swift is becoming a liability for Apple and it may actually impact its app ecosystem negatively in the long term.
I hope they make a drastic change to it. Java was able to turn around, and start becoming a better language, I hope Swift does to, by simplifying and removing features and not just piling stuff into it.
I don't use Swift full time and I had no problem reading that method signature.
This is something that you would write if you were a library author interested in providing generic and flexible data structure. The part after "where" expresses a non-trivial idea: "the type of the first element parameter should be the same as the inner element of the homogenous collection (second parameter), and we need to compare elements to other instances of its type but other than those constraints this code will work on any element and collection". It does that in about 6 swift terms, and the compiler has a full understanding of what you meant and will prevent errors that violate these constraints. Notice that you never have to write this type of code if you're using the library. Swift has decently organized progressive disclosure of language features. For example I never had to write unsafe pointer arithmetic or interop with C, but I'm not going to complain the feature is there for those that need it.
So. This. I have been a long time Apple fan. I noticed many years ago that they had a disproportionate representation amongst creative programmer types. I was intrigued and have come to understand why. It's not perfect, and Apple pisses me off some days, but overall the ratio of "It Just Works/WTF?" has been higher for me than other platforms.
As a Smalltalk guy, Objective-C was tragically comic, but nevertheless effective. It was like talking cavemen with your partner, and giggling about it, but you could still get stuff done.
When they announced Swift as "without the C", I was originally excited/intrigue. Despite some original surprises, I soon told peers "I've always hated C++, this feels like a decent compromise that I could like."
For quite some time, I've prototyped first on iOS, refined, and then replicated in Android. Because it was easier/better in Apple's stack than it was in Android.
At this point, I've given up. It's as complicated as C++, maybe more so. The Android development story is not all that much easier (Kotlin improves some things, but it's still Android), but Apple has actively lost their edge (for me) due to the added complexity.
I still write Swift on a pretty regular basis (I maintain/evolve 3+ apps with it). But to the point, I no longer want to. I'm actively interested in an alternate method of writing app UIs.
The SQL analogy is a good one– what the function signature is doing is specifying a constraint between 2 otherwise unrelated values. Otherwise you could call the function with an array of `String`s an ask it for the index of an `Int`.
Or maybe because I'm saying this because I'm already acquainted to the evil monstrosities of C++. Here's the same function: (and this is even with C++20 concepts on):
// Yes, you need to include some headers to get even the most basic features! Typical C++.
#include <type_traits>
#include <optional>
template <Collection Elements, Equatable Element,
typename = std::enable_if_t<std::is_same_v<typename Elements::Element, Element>>>
std::optional<typename Elements::Index> index(Element element, const Elements& collection) {
// Function body
}Aside from the `where` keyword, I don't see much similarity with SQL. That said, I'm a big fan of SQL, so I might be blind to the issue.
Several other people have already said it, but I find that definition pretty easy to read, and I've never been paid to write a line of Swift. The most confusing part for me was the fact that the argument names seem to have spaces in them. The type constraints look pretty nice to me, to be honest.
I prefer
Language Design Team, Compiler (Backend/Frontend)? Team and similar more
But there has to be some mechanism for overall coordination, and with Rust that's the Core team.
The people that actually do the work on Swift are those that control the language and its destiny. You could fork it, but without a similar amount of effort behind your fork there's no way you can convince people to switch from the mainline.
The question more is, is bothering to learn native smartphone app development a bad investment of time now that the low hanging fruit is gone and we're due for a new platform paradigm?
While Swift can be used for linux desktop or as a backend language, what mostly matters for practical projects is the libraries, and I think for those cases the better libraries are on other languages.
Are you writing something else? Then, it's probably not the best investment to learn Swift.
I propose learning Kotlin if you want something syntactically similar but with broader set of usecases or Rust if the lack of runtime with modern syntax is what is appealing to you.
UPDATE: very good points below about the internet mob that would attack in response. Sad, but true.
This is a post to the internet, and I don't think having someone get flamed by a bunch of people online is a conducive way to settle a disagreement, whether they were being unprofessional or not.
> Maybe they'd learn and work on their behavior if someone told them?
I think the problem here is that there would be an online mob constantly telling them.
At least that’s the positive angle. The negative one is they are some kind of scumbag with enough leverage to keep their ass covered and picked a fight they thought they could win, but didn’t win enough to avoid consequences, just not public consequences.
Especially since words once said/written can never be taken back.
but when the same thing happen for rust, it's censorship, nobody talks about rust's internal problems
that's part of the reason i choose to not give rust another chance
the sectarian aspect of it is disgusting, to say the least
You clearly can see through the bias in HN, and each project has its controversies. Out of any project that I have seen that has had drama like this, the one that is more of a cult and has its problems hidden from view is most definitely Rust.
Just look at how this one went [0] or the level of discussion that is going on in [1] and [2]. The way the foundation was setup seems to be heading into another disaster, which even the main promoter of it is starting to distance away from it after getting upset about Amazon [3].
I won't be surprised to see the next controversy in Rust hidden away from view vs the controversies in other communities.
[0] https://news.ycombinator.com/item?id=29501893
[1] https://news.ycombinator.com/item?id=29306845
without parameter names, something like `func range(int, int)` can become dangerous because you dont know if the first parameter is the start and end or is it start and length?
`range(start: int, end: int)` makes it clear at the call site what is going on and gives your brain enough info to not mess up the parameters (especially when refactoring or fixing bugs in existing code)
Why can't I have a variable that has a protocol as type?
Why can't I pass a substring to a function that wants a string?
Why is string parsing so much harder than it should be?
Mike Ash answered[0] this question back in 2015.
[0] https://www.mikeash.com/pyblog/friday-qa-2015-11-06-why-is-s...