168 points · by samcat116 · 5y ago · 128 comments
I hope for this too. I did a personal project in Swift on Linux and found that I loved the language. However, I was greatly frustrated by the lack of libraries. For Swift to reach the mainstream, IMHO, the Swift Foundation needs to move much more of the ecosystem to platforms other than Apple's. I would vote for that even ahead of adding new features to the language.
I suspect Apple is trying to do this for straightforward reasons like wanting to remain relevant and foster community growth as to retain credibility… while also subtly trying to not encourage the use of Swift as a language for any other GUI framework/platform than Cocoa + macOS. Obviously I don’t have any evidence to support my fantasy speculation (well, X11 for macOS is dead) - but consider how Apple is so very protective of their UX moat (and PWAs be damned). It’s not in Apple’s interests to facilitate and support any kind of true cross-platform UI framework: remember how Java AWT/Swing apps were like on OS X? The majority of dispassionate (I.e. not Panic Inc) devs are never going to optimise a cross-platform UI for macOS because the whole point of using an xplat UI is so you don’t need to spend time on platform-specific code. Those two reasons combine form a vicious-cycle negative feedback loop that devalues their platform.
But with the web finally becoming the true, real, cross-platform that Microsoft was then-irrationally terrified of 25 years ago, I don’t know what Apple’s strategy is to remain the best provider of the best UX when everyone is going to be using Chromium in some form. And if Apple keeps pushing their own native apps devs to their hostile App Store while everyone else moves to the web, then the value-prop of an Apple computer looks bad compared to a Chromebook which is essentially just-as-locked-down and just-as-capable, just without iOS integration and a modest selection of (albeit) high-quality boutique Mac App Store apps.
————
On a related note: Apple does not have long-term support commitments as a matter of policy - which means enterprise/slow-moving/blue-chips won’t be interested in using Swift at all (compared to ISO-backed C++, Oracle’s Java, or MS’ .NET). Apple is going to have to maintain Swift’s support for Win32 and *nix in the long-run if they need to build their credibility and win-over large programming projects - but it’s just so against their corporate culture. It reminds me of their middling support for Safari for Windows. I know Apple gets Win32 and nix support for Swift “for free” by piggybacking off Clang+LLVM, but that’s basically the same as making Swift more like Java (“xplat for free”) but that’s just the bare-minimum they need to do: without Apple actively investing significantly in the developer experience for non-Apple platforms it just isn’t going to take-off. And they can’t do that for fear that a critical-mass of hackers will port Cocoa to Win32.
Swift is basically analogue to Google’s Dart+Flutter but it wants to be like Go.
The app I was working on was CLI-based that generated a log; and even for that non-UI use case, basic libraries were effectively missing.
It's a shame because it's truly an elegant language.
This certainly seems to be the case for desktop apps but not so much for mobile. Personally I'm rooting for the mobile web but the momentum seems to be on Apple's side right now.
I don’t think this is nefarious. X11 is a klunky GUI, at best, compared with pretty much everything else out there. It really can’t hold a candle to more developed GUI systems.
I was never interested in Swift as a server language, but that’s mainly because of the “chicken-and-egg” thing, as it was not supported by server infrastructure. I love the language, itself.
Imagine if Apple /Microsoft would invest some dev hours in Java/Qt so it keeps up with the updates they put out, we could get decent cross platform apps but Apple/Microsoft don't want cross platform apps/games.
It is no surprise that the only UNIX clones that had a good desktop user experience always did their own thing instead of pursuing the X11/Motif path.
As far as adoption goes, many large codebases are likely still ObjC; simply because of hysteresis. Major architectural shifts take a lot of time, money and risk. That’s one reason I don’t feel that much urgency to jump on the SwiftUI/Async stuff (but I like what I see). I’m interested in shipping, and shipping is almost always a couple (or more) steps back from “the bleeding edge.”
In my experience, there’s not much of a downside to waiting for tech to mature and stabilize, other than not having jargon on my CV.
Swift was unusual for me. I started learning it, and releasing apps in it, right away. It was a gamble, and it paid off. There’s lots of folks that are probably just getting started with Swift, now.
I am still writing Swift despite being retired but as part of my art generation work now.
I imagine this has gotten a lot better since, particularly with stuff like Swift UI. That said, I’d personally find Swift more compelling to use as a server language.
What's old is new again, as they say.
[1] https://developer.apple.com/library/archive/documentation/Co...
That said, I guess Swift is trying to do a better version of DO.
https://en.wikipedia.org/wiki/Distributed_Objects_Everywhere
> By the time DOE, now known as NEO, was released in 1995, Sun had already moved on to Java as their next big thing. Java was now the GUI of choice for client-side applications, and Sun's OpenStep plans were quietly dropped (see Lighthouse Design). NEO was re-positioned as a Java system with the introduction of the "Joe" framework, but it saw little use. Components of NEO and Joe were eventually subsumed into Enterprise JavaBeans.
I just don't understand the vision.
Wait what? Julia has been growing very consistently for years now. I don’t think anyone with a reasonably informed opinion thought Julia was going to take over the whole world in the blink of an eye.
It seems to be going right along the lines that most people I know in the community expected.
While there is big-company momentum behind swift on servers, it’s always a second-class citizen compared to its own native platforms (iOS & macOS).
After IBM stopped backing it, pretty much killed credibility in server-side swift.
We switched over to Rust fairly early on, and we were glad we did.
I think the realization was that client-side app engineering is just different from distributed back-end systems.
On iOS, we have a very rich set of standard toolkits we can consume. So development is fast and streamlined. Battle-hardened.
But with swift on servers, you’re reinventing the wheel for even the most basic things. So it may very well be a completely different language on the backend at that point.
This approach of ignoring the rest of the world and explaining Swift concepts as if they exist in a vacuum is frustrating and counter-productive.
Even if this were a totally new feature, I'd expect links to research papers.
It is one thing to present end users with 'shiny new iphone' every year. It is another to treat developers like idiots and have every swift related announcement be this sales pitch of 'great new feature' when in reality they are all features other languages have had for decades (and are thus mature, while Swift is always half-baked and full of gotchas) and this is yet another re-implementation of what already exists with undocumented arbitrary differences that people then have to spend time to figure out (aka free beta test) when I'm sure the people who implement this stuff (hopefully) know full well what trade-offs they are making.
(Distributed) actor model is nothing new, but I definitely wouldn't classify it as something that's common in other languages. To my knowledge Erlang/OTP is the only mainstream language where this is part of the standard library.
There are implementations for other languages, such as Akka for Java/Scala and Orleans for dotnet, but most languages (sadly) don't have a battle-tested implementation of this.
I’d argue that this is because it’s a failed idea that conflates OO encapsulation, concurrency constraints, identity, serialization, and networking into a behemoth that does none of those things well.
Also Akka for .NET and my echo-process library
Not only that, they expect people to test their beta grade software because they keep releasing it half baked ever since the release of Swift itself.
It's embarrassing and it also angers me because these companies have wall gardened their ecosystems to proprietary languages and tools that all do the same thing poorly, differently and in ways that prevent sane cross platform development, on purpose, this being yet another apple-only 'thing'.
Here's Swift's roadmap: copy C# and other languages for the next 5 years while making sure you can't write cross platform code by adding arbitrary garbage like SwiftUI or this 'distributed actor' implementation that will surely differ and not be compatible with existing features of other languages and their tooling.
Kotlin's roadmap... Copy Gosu and Groovy
Java's roadmap... Make Gosu, Groovy and Kotlin redundant by supporting the idioms of Gosu and Kotlin eventually and force those languages to 'nativize' their underlying implementations.
Manifold's roadmap... Ditch Gosu on the JVM and make a java library, copy all the stuff Java doesn't' have a plan for like .Net's (and by extension Gosu's) class extensions and java 8 to 9 workarounds
We could go on and on. Nothing new under the sun. Great minds think alike and at the end of the day the value of delivering a product is what matters in the end.
[1]: https://github.com/ktoso/swift-evolution/blob/distributed-re...
You could be forgiven for not being familiar with the Actor model. But if you’re familiar with it, saying that isn’t recognition is bonkers. Everyone who knows what Actors are knows they’re referencing Erlang/OTP.
I've been writing server-side / enterprise code in Swift for about a year now, and the language has really grown on me.
But it's a small community, and IBM's & Google's departures were a big blow to the feeling of inevitable growth to it.
I'd love to find a watering hole to chat with others in the same small niche.
Being able to reuse code between ios and android, including foundation api, would have made an easy way to grow the user base.
it's going to be hard to put swift in the hands of go or kotlin devs..
Guess what happened to Apportable? It was quietly acquired by Google and completely shut down within days, with practically no traces left on GitHub or the rest of the Internet.
This is because Google will be hostile to any compatibility layer that places iOS in a privileged position and makes Android a second-class citizen, an afterthought in your development process.
With this story in mind, I don't think Apple would step into that territory.
https://developer.android.com/ndk/guides
> Squeeze extra performance out of a device to achieve low latency or run computationally intensive applications, such as games or physics simulations.
> Reuse your own or other developers' C or C++ libraries.
Using this set of public APIs:
https://developer.android.com/ndk/guides/stable_apis
Anything else is going into the "works on my device dunno about your's" territory.
One way to think about this is propagators. I’m still learning myself, but a compelling example is lisp. With lisp you can write macros that essentially allow you to treat your code as a tree and arbitrarily modify that tree (aka arbitrarily write code). You can then compile that code while the system is running and execute it. It’s not just about macro expansion at startup or a single compile time step at the beginning of execution. The system can be designed with this in mind.
It’s also about introspection, the ability to ask questions about the system at runtime as it evolves.
Sussman and Kay both talk a lot about DNA and biology, and the ability for systems to dynamically expand, change, and repair themselves.
When I think about this kind of stuff nowadays I picture something like lisp with an execution environment like the BEAM (so basically LFE) and an introspection system powered by a declarative constraint solving query language (something like Datalog-style RDF found in things like datalevin and it’s predecessors). I think that lends itself really well to these kinds of systems, including another point that Kay talks about pretty frequently. The ability for two systems (and in our cases two actors in one environment count) to negotiate with each other via some shared fundamental language to understand each other’s purpose. SOP style approaches seem like a compelling way to do that, but the main problem to me is identifying entities as globally unique as part of that negotiation process.
Also don’t listen to me, I’m a monkey.
In recent month's, every time I run across the whole "OO is evil/dead/horrible" meme (esp. common here) it turns out to be someone talking whose experience of "OO programming" is limited to C++/Java and their relatives. If your only exposure to OO was those (and similar) languages, then, YES, OO is horrible and weak and full of leakiness in the abstractions. It's a bit like saying that coffee is horrible when all you've ever tasted is cheap-and-nasty instant made from acorns and floor sweepings. C++ and Java (I can't comment on C#, never having used it in anger) are the palest, anaemic shadow of OO programming.
Rant done. This addition to Swift might cause me to look at it more closely. (I don't have any reason/desire to touch the Apple grow-tunnel (as opposed to ecosystems, which are natural and open.) My thoughts have also recently run along lines of "What if we made every message to an object as if it were always remote (in another address space)?" In other words, for decades we've been trying to make RPC calls look (to the programmer) as if they were "just like local calls" and with justifiable lack of success because remote really is more wrinkly than local. So what if, instead of trying to make "remote" look/behave/imitate "local" we went in the other direction and make all calls look like remote calls? It means we have to think about all the failure modes and partial-failure modes of remote calls all of the time. Only, for local address-space calls, they're going to be much more reliable in practise. Is it worth it? Can we bring down the cognitive overhead to an acceptable level?
I'm interested to see whether this Swift effort/initiative approaches this idealised/simplified description.
However, not having a mathematical foundation has been a
severe limitation for Erlang.
The Erlang community is trying to dig its way out with
modifications and extensions. Still have a long way to go.
Of course, no Actors framework is perfect.
Many important implementations have been done Erlang.
Also, significant Erlang projects are ongoing to good effect.
[0] I put actors in quotes because neither are true actor system, either. Nor were either designed to be, though if you squint they look similar.
analogous to the Natural Numbers in classical mathematics.
"Writing Concurrent Object-Oriented Programs using Smalltalk-80"
http://www.wolczko.com/mushroom/compj.pdf
"Actra = A Multitasking / Multiprocessing Smalltalk"
https://dl.acm.org/doi/10.1145/67387.67409
Actra -- an industrial strength concurrent object-oriented programming system
So now we'll have Akka, Elixir, Erlang and Swift as options. Pretty exciting!
edit: Rust's Actix too!
edit2: jk Actix is only local.
We’ve gone through this so many times, and — outside the very specialized Erlang — the result is always the same. It doesn’t work.
OO Actors are a terrible concurrency model, and an even worse networking, protocol definition, and serialization model.
The distributed features work as intended to great effect with only certain edge cases (split brain for example) that need to have care but at that point in scale, you're already leveraging all the best parts.
I'd like to propose an actually dead idea: calling ideas dead. That we fail with tech ideas & abstractions is 99.%%% of the time not really reflective of the idea itself. There's survivorship bias- well, I think we need a term for the opposite: didn't work bias. A lot of technologies are dogged by image problems from less than successful pasts. Too often we pop culturally & en-masse accept that specific failures imply general unsuitability, and become fixed, hostile, & negative towards ideas. We should label this phenomenon & understand it better. "Didn't Work Bias" doesn't quite feel like the best fit or reciprocal to Survivorship Bias but it's a start at capturing these prevalent anti-idea sentimentalities.
but missed a few things. See
See article and video here:
There is is an upcoming keynote address on the Actor Paradigm at the Linux 30th Anniversary Conference. See
Lisp Flavoured Erlang! ;-)
(@clojure would like to have [a few words])computer boundaries.
The Swift team seems to be challenging that thesis:
"[U]nlike other concurrency models, the actor model is also tremendously valuable for modeling distributed systems. Thanks to the notion of location transparent distributed actors, we can program distributed systems using the familiar idea of actors and then readily move it to a distributed, e.g., clustered, environment.
With distributed actors, we aim to simplify and push the state of the art of distributed systems programming, the same way we did with concurrent programming with local actors and Swift’s structured concurrency models embedded in the language.
This abstraction does not intend to completely hide away the fact that distributed calls are crossing the network, though. In a way, we are doing the opposite and programming assuming that calls may be remote. This small yet crucial observation allows us to build systems primarily intended for distribution and testable in local test clusters that may even efficiently simulate various error scenarios.
Distributed actors are similar to (local) actors because they encapsulate their state with communication exclusively through asynchronous calls. The distributed aspect adds to that equation some additional isolation, type system, and runtime considerations. However, the surface of the feature feels very similar to local actors."
Amusingly, in a section immediately followed by "Deja Vu All Over Again", Waldo et al. write:
"One conceptual justification for this vision is that whether a call is local or remote has no impact on the correctness of a program. If an object supports a particular interface, and the support of that interface is semantically correct, it makes no difference to the correctness of the program whether the operation is carried out within the same address space, on some other machine, or off-line by some other piece of equipment. Indeed, seeing location as a part of the implementation of an object and therefore as part of the state that an object hides from the outside world appears to be a natural extension of the object-oriented paradigm.
Such a system would enjoy many advantages. It would allow the task of software maintenance to be changed in a fundamental way. The granularity of change, and therefore of upgrade, could be changed from the level of the entire system (the current model) to the level of the individual object. As long as the interfaces between objects remain constant, the implementations of those objects can be altered at will. Remote services can be moved into an address space, and objects that share an address space can be split and moved to different machines, as local requirements and needs dictate. An object can be repaired and the repair installed without worry that the change will impact the other objects that make up the system. Indeed, this model appears to be the best way to get away from the “Big Wad of Software” model that currently is causing so much trouble.
This vision is centered around the following principles that may, at first, appear plausible:
• there is a single natural object-oriented design for a given application, regardless of the context in which that application will be deployed;
• failure and performance issues are tied to the implementation of the components of an application, and consideration of these issues should be left out of an initial design; and
• the interface of an object is independent of the context in which that object is used.
Unfortunately, all of these principles are false. In what follows, we will show why these principles are mistaken, and why it is important to recognize the fundamental differences between distributed computing and local computing."
RMI, some may recall, was heavily influenced by the above critique which lead to the very verbose and ceremonial characteristics of Sun's Java distributed system's APIs that were later criticized as cumbersome.
[1]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.7...
[2]: http://www.cs.yale.edu/homes/aspnes/classes/465/notes.pdf
See the following:
Citadels: faster response time and better information integration than remote datacenters
https://papers.ssrn.com/abstract=2836282with having to annotate each message send with whether the
receiver is on the current computer or another one in a
Citadel.
Since Actors can move between computers in a Citadel, such
annotations are infeasible in practice.
Of course, modularity, security, and performance should not be
ignored.
So, if the Actor Model is in fact reducible to a complex RPC framework, the question remains if we should distinguish between RPC and local PC without throwing ~mystical bits about actors into the question.
In any event, I was wrong in my OP about Swift's approach: it is in fact the Waldo approach with distinct treatment of remote ops, except instead of annotations, it is language level support and instead of instrumenting existing code (ala Java byte codes), it is the compiler that writes the boiler plate for the underlying RPCs.
Consider yourself lucky not having to deal with raw IDL without VS tooling and ATL template metaprogramming.
The reason is: you want certain guarantees. For example, in Erlang you can set up a monitor on a process, and when that process exits for any reason, you get a notification, {EXIT, Reason}. Even if that reason was a catastrophic failure of some sort.
If this is implemented as a library, then the runtime can kill your code at any time, and you'll never know what happened.
Compare Erlang's error handling and monitors: https://erlang.org/doc/reference_manual/processes.html#error...