12 comments

  • scottmf4 hours ago
    Concurrency issues aside, I&#x27;ve been working on a greenfield iOS project recently and I&#x27;ve really been enjoying much of Swift&#x27;s syntax.<p>I’ve also been experimenting with Go on a separate project and keep running into the opposite feeling — a lot of relatively common code (fetching&#x2F;decoding) seems to look so visually messy.<p>E.g., I find this Swift example from the article to be very clean:<p><pre><code> func fetchUser(id: Int) async throws -&gt; User { let url = URL(string: &quot;https:&#x2F;&#x2F;api.example.com&#x2F;users&#x2F;\(id)&quot;)! let (data, _) = try await URLSession.shared.data(from: url) return try JSONDecoder().decode(User.self, from: data) } </code></pre> And in Go (roughly similar semantics)<p><pre><code> func fetchUser(ctx context.Context, client *http.Client, id int) (User, error) { req, err := http.NewRequestWithContext( ctx, http.MethodGet, fmt.Sprintf(&quot;https:&#x2F;&#x2F;api.example.com&#x2F;users&#x2F;%d&quot;, id), nil, ) if err != nil { return User{}, err } resp, err := client.Do(req) if err != nil { return User{}, err } defer resp.Body.Close() var u User if err := json.NewDecoder(resp.Body).Decode(&amp;u); err != nil { return User{}, err } return u, nil } </code></pre> I understand <i>why</i> it&#x27;s more verbose (a lot of things are more explicit by design), but it&#x27;s still hard not to prefer the cleaner Swift example. The success path is just three straightforward lines in Swift. While the verbosity of Go effectively buries the key steps in the surrounding boilerplate.<p>This isn&#x27;t to pick on Go or say Swift is a better language in practice — and certainly not in the same domains — but I do wish there were a strongly typed, compiled language with the maturity&#x2F;performance of e.g. Go&#x2F;Rust and a syntax a bit closer to Swift (or at least closer to how Swift feels in simple demos, or the honeymoon phase)
    • tarentel1 hour ago
      As someone who has been coding production Swift since 1.0 the Go example is a lot more what Swift in practice will look like. I suppose there are advantages to being able to only show the important parts.<p>The first line won&#x27;t crash but in practice it is fairly rare where you&#x27;d implicitly unwrap something like that. URLs might be the only case where it is somewhat safe. But a more fair example would be something like<p><pre><code> func fetchUser(id: Int) async throws -&gt; User { guard let url = URL(string: &quot;https:&#x2F;&#x2F;api.example.com&#x2F;users&#x2F;\(id)&quot;) else { throw MyError.invalidURL } &#x2F;&#x2F; you&#x27;ll pretty much never see data(url: ...) in real life let request = URLRequest(url: url) &#x2F;&#x2F; configure request let (data, response) = try await URLSession.shared.data(for: request) guard let httpResponse = response as? HTTPURLResponse, 200..&lt;300 ~= httpResponse.statusCode else { throw MyError.invalidResponseCode } &#x2F;&#x2F; possibly other things you&#x27;d want to check return try JSONDecoder().decode(User.self, from: data) } </code></pre> I don&#x27;t code in Go so I don&#x27;t know how production ready that code is. What I posted has a lot of issues with it as well but it is much closer to what would need to be done as a start. The Swift example is hiding a lot of the error checking that Go forces you to do to some extent.
      • Jtsummers1 hour ago
        I&#x27;m not familiar with Swift&#x27;s libraries, but what&#x27;s the point of making this two lines instead of one:<p><pre><code> let request = URLRequest(url: url) let (data, response) = try await URLSession.shared.data(for: request) &#x2F;&#x2F; vs let (data, response) = try await URLSession.shared.data(from: url) </code></pre> That aside, your Swift version is still about half the size of the Go version with similar levels of error handling.
        • tarentel1 hour ago
          The first one you can configure and it is the default way you&#x27;d see this done in real life. You can add headers, change the request type, etc. Likely, if you were making an actual app the request configuration would be much longer than 1 line I used. I was mostly trying to show that the Swift example was hiding a lot of things.<p>The second one is for downloading directly from a URL and I&#x27;ve never seen it used outside of examples in blog posts on the internet.
    • tidwall3 hours ago
      Or this.<p><pre><code> func fetchUser(id int) (user User, err error) { resp, err := http.Get(fmt.Sprintf(&quot;https:&#x2F;&#x2F;api.example.com&#x2F;users&#x2F;%d&quot;, id)) if err != nil { return user, err } defer resp.Body.Close() return user, json.NewDecoder(resp.Body).Decode(&amp;user) }</code></pre>
      • jtbaker3 hours ago
        I&#x27;m conflicted about the implicit named returns using this pattern in go. It&#x27;s definitely tidier but I feel like the control flow is harder to follow: &quot;I never defined `user` how can I return it?&quot;.<p>Also those variables are returned even if you don&#x27;t explicitly return them, which feels a little unintuitive.
        • ragnese2 hours ago
          I haven&#x27;t written any Go in many years (way before generics), but I&#x27;m <i>shocked</i> that something so implicit and magical is now valid Go syntax.<p>I didn&#x27;t look up this syntax or its rules, so I&#x27;m just reading the code totally naively. Am I to understand that the `user` variable in the final return statement is not really being treated as a value, but as a reference? Because the second part of the return (json.NewDecoder(resp.Body).Decode(&amp;user)) sure looks like it&#x27;s going to change the value of `user`. My brain wants to think it&#x27;s &quot;too late&quot; to set `user` to anything by then, because the value was already read out (because I&#x27;m assuming the tuple is being constructed by evaluating its arguments left-to-right, like I thought Go&#x27;s spec enforced for function arg evaluation). I would think that the returned value would be: `(nil, return-value-of-Decode-call)`.<p>I&#x27;m obviously wrong, of course, but whereas I always found Go code to at least be fairly simple--albeit tedious--to read, I find this to be very unintuitive and fairly &quot;magical&quot; for Go&#x27;s typical design sensibilities.<p>No real point, here. Just felt so surprised that I couldn&#x27;t resist saying so...
          • jtbaker1 hour ago
            yeah, not really an expert but my understanding is that naming the return struct automatically allocates the object and places it into the scope.<p>I think that for the user example it works because the NewDecoder is operating on the same memory allocation in the struct.<p>I like the idea of having named returns, since it&#x27;s common to return many items as a tuple in go functions, and think it&#x27;s clearer to have those named than leaving it to the user, especially if it&#x27;s returning many of the same primitive type like ints&#x2F;floats:<p>``` type IItem interface { Inventory(id int) (price float64, quantity int, err error) } ```<p>compared to<p>``` type IItem interface { Inventory(id int) (float64, int, error) } ```<p>but feel like the memory allocation and control flow implications make it hard to reason about at a glance for non-trivial functions.
          • Someone50 minutes ago
            &gt; My brain wants to think it&#x27;s &quot;too late&quot; to set `user` to anything by then, because the value was already read out<p>It doesn’t set `user`, it returns the User passed to the function.<p>Computing the second return value modifies that value.<p>Looks weird indeed, but conceptually, both values get computed before they are returned.
    • hocuspocus3 hours ago
      Not defending Go&#x27;s braindead error handling, but you&#x27;ll note that Swift is doubly coloring the function here (async throws).
      • tarentel2 hours ago
        What is the problem with that though? I honestly wish they moved the async key word to the front `async func ...` but given the relative newness of all of this I&#x27;ve yet to see anyone get confused by this. The compiler also ensures everything is used correctly anyway.
        • hocuspocus1 hour ago
          The problem is that that the Swift function signature is telling you that someone else needs dealing with async suspension and exception handling, clearly not the same semantics.
          • tarentel1 hour ago
            In a sense it is telling someone else that yes, but more importantly, it is telling the compiler. I am not sure what the alternative is here, is this not common in other languages? I know Java does this at least. In Python it is hidden and you have to know to catch the exception. I&#x27;m not sure how that is better as it can be easily forgotten or ignored. There may be another alternative I&#x27;m not aware of?
    • neonsunset3 hours ago
      C# :)<p><pre><code> async Task&lt;User&gt; FetchUser(int id, HttpClient http, CancellationToken token) { var addr = $&quot;https:&#x2F;&#x2F;api.example.com&#x2F;users&#x2F;{id}&quot;; var user = await http.GetFromJsonAsync&lt;User&gt;(addr, token); return user ?? throw new Exception(&quot;User not found&quot;); }</code></pre>
  • mojuba3 hours ago
    It&#x27;s a good article but I think you need to start explaining structured concurrency from the very core of it: why it exists in the first place.<p>The design goal of structured concurrency is to have a safe way of using all available CPU cores on the device&#x2F;computer. Modern mobile phones can have 4, 6, even 8 cores. If you don&#x27;t get a decent grasp of how concurrency works and how to use it properly, your app code will be limited to 1 or 1.5 cores at most which is not a crime but a shame really.<p>That&#x27;s where it all starts. You want to execute things in parallel but also want to ensure data integrity. If the compiler doesn&#x27;t like something, it means a design flaw and&#x2F;or misconception of structured concurrency, not &quot;oh I forgot @MainActor&quot;.<p>Swift 6.2 is quite decent at its job already, I should say the transition from 5 to 6 was maybe a bit rushed and wasn&#x27;t very smooth. But I&#x27;m happy with where Swift is today, it&#x27;s an amazing, very concise and expressive language that allows you to be as minimalist as you like, and a pretty elegant concurrency paradigm as a big bonus.<p>I wish it was better known outside of the Apple ecosystem because it fully deserves to be a loved, general purpose mainstream language alongside Python and others.
    • ragnese2 hours ago
      &gt; It&#x27;s a good article but I think you need to start explaining structured concurrency from the very core of it: why it exists in the first place.<p>I disagree. Not every single article or essay needs to start from kindergarten and walk us up through quantum theory. It&#x27;s okay to set a minimum required background and write to that.<p>As a seasoned dev, every time I have to dive into a new language or framework, I&#x27;ll often want to read about styles and best practices that the community is coalescing around. I <i>promise</i> there is no shortage at all of articles about Swift concurrency aimed at junior devs for whom their iOS app is the very first real programming project they&#x27;ve ever done.<p>I&#x27;m not saying that level of article&#x2F;essay shouldn&#x27;t exist. I&#x27;m just saying there&#x27;s more than enough. I almost NEVER find articles that are targeting the &quot;I&#x27;m a newbie to this language&#x2F;framework, but not to programming&quot; audience.
  • travisgriggs2 hours ago
    &gt; Instead of callbacks, you write code that looks sequential [but isn’t]<p>(bracketed statement added by me to make the implied explicit)<p>This sums up my (personal, I guess) beef with coroutines in general. I have dabbled with them since different experiments were tried in C many moons ago.<p>I find that programming can be hard. Computers are very pedantic about how they get things done. And it pays for me to be explicit and intentional about how computation happens. The illusory nature of async&#x2F;await coroutines that makes it seem as if code continues procedurally demos well for simple cases, but often grows difficult to reason about (for me).
    • jesuslop2 hours ago
      That is the price you pay. If you refuse to pay you are left to express a potentially complex state machine in terms of a flat state-transition table, so you have a huge python cases statement saying on event x do this and on event y do that. That obscures evident state-chart sequentiality, alternatives or loops (the stuff visible in the good old flow-charts) that otherwise could be mapped in their natural language constructs. But yes, is not honest flow. Is a tradeoff.
  • MORPHOICES4 hours ago
    How do you actually learn concurrency without fooling yourself?<p>Every time I think I “get” concurrency, a real bug proves otherwise.<p>What finally helped wasn’t more theory, but forcing myself to answer basic questions:<p>What can run at the same time here?<p>What must be ordered?<p>What happens if this suspends at the worst moment?<p>A rough framework I use now:<p>First understand the shape of execution (what overlaps)<p>Then define ownership (who’s allowed to touch what)<p>Only then worry about syntax or tools<p>Still feels fragile.<p>How do you know when your mental model is actually correct? Do you rely on tests, diagrams, or just scars over time?
    • tetha34 minutes ago
      I&#x27;ve written, tested and debugged low-level java concurrency code involving atomics, the memory safety model and other nasty things. All the way down to considerations if data races are a problem or just redundant work and similar things. Also implementing coroutines in some complang-stuff in uniersity.<p>This level is rocket science. If you can&#x27;t tell why it is right, you fail. Such a failure, which was just a singular missing synchronized block, is the _worst_ 3-6 month debugging horror I&#x27;ve ever faced. Singular data corruptions once a week on a system pushing millions and trillions of player interactions in that time frame.<p>We first designed with many smart people just being adverse and trying to break it. Then one guy implemented, and 5-6 really talented java devs reviewed entirely destructively, and then all of us started to work with hardware to write testing setups to break the thing. If there was doubt, it was wrong.<p>We then put that queue, which sequentialized for a singular partition (aka user account) but parallelized across as many partitions as possible live and it just worked. It just worked.<p>We did similar work on a caching trie later on with the same group of people. But during these two projects I very much realized: This kind of work just isn&#x27;t feasible with the majority of developers. Out of hundreds of devs, I know 4-5 who can think this way.<p>Thus, most code should be structured by lower-level frameworks in a way such that it is not concurrent on data. Once you&#x27;re concurrent on singular pieces of data, the complexity explodes so much. Just don&#x27;t be concurrent, unless it&#x27;s trivial concurrency.
    • jesuslop2 hours ago
      Heisembugs aren&#x27;t just technical debt but project killer time bombs so one must better have a perfect thread design in head that works first attempt, else is hell on earth. I can be safe in a bubble world with whole process scope individual threads or from a thread pool (so strong guarantees of joining every created thread) and having share-nothing threads communicating only by prosumer sync-queues that bring a clear information-flow picture. One can have a message pump in one thread, as GUI apps do. That is just a particular case of the prosumer channel idea before. Avoid busy waits, wait on complex event conditions by blocking calls to select() on handler-sets or WaitForMultipleObjects(). Exceptions are per thread, but is good to have a polite mechanism to make desired ones to be potentially process-fatal, and fail earliest. This won&#x27;t cover all needs but is a field-tested start.
    • mrkeen3 hours ago
      Share xor mutate, that&#x27;s really all there is
      • ragnese2 hours ago
        Talk about trivializing complexity...<p>The idea that making things immutable somehow fixes concurrency issues always made me chuckle.<p>I remember reading and watching Rich Hickey talking about Clojure&#x27;s persistent objects and thinking: Okay, that&#x27;s great- another thread can&#x27;t change the data that my thread has because I&#x27;ll just be using the old copy and they&#x27;ll have a new, different copy. But now my two threads are working with different versions of reality... that&#x27;s STILL a logic bug in many cases.<p>That&#x27;s not to say it doesn&#x27;t help at all, but it&#x27;s EXTREMELY far from &quot;share xor mutate&quot; solving all concurrency issues&#x2F;complexity. Sometimes data needs to be synchronized between different actors. There&#x27;s no avoiding that. Sometimes devs don&#x27;t notice it because they use a SQL database as the centralized synchronizer, but the complexity is still there once you start seeing the effect of your DB&#x27;s transaction level (e.g., repeatable_read vs read_committed, etc).
        • mrkeen1 hour ago
          It&#x27;s not that shared-xor-mutate magically solves everything, it&#x27;s that shared-and-mutate magically breaks everything.<p>Same thing with goto and pointers. Goto kills structured programming and pointers kill memory safety. We&#x27;re doing fine without both.<p>Use transactions when you want to synchronise between threads. If your language doesn&#x27;t have transactions, it probably can&#x27;t because it already handed out shared mutation, and now it&#x27;s too late to put the genie in the bottle.<p>&gt; This, we realized, is just part and parcel of an optimistic TM system that does in-place writes.<p>[1] <a href="https:&#x2F;&#x2F;joeduffyblog.com&#x2F;2010&#x2F;01&#x2F;03&#x2F;a-brief-retrospective-on-transactional-memory&#x2F;" rel="nofollow">https:&#x2F;&#x2F;joeduffyblog.com&#x2F;2010&#x2F;01&#x2F;03&#x2F;a-brief-retrospective-on...</a>
          • ModernMech1 hour ago
            +5 insightful. Programming language design is all about having the right nexus of features. Having all the features or the wrong mix of features is actually an anti-feature.<p>In our present context, <i>most</i> mainstream languages have already handed out shared mutation. To my eye, this is the main reason so many languages have issues with writing asynch&#x2F;parallel&#x2F;distributed programs. It&#x27;s also why Rust has an easier time of it, they <i>didn&#x27;t</i> just hand out shared mutation. And also why Erlang has the best time of it, they built the language <i>around</i> no shared mutation.
  • sebastianconcpt21 minutes ago
    But how would you do what in Rust&#x27;s Tokio is a `spawn_blocking` in Swift?
  • seanalltogether4 hours ago
    One of the things that really took me a long time to map in my head correctly is that in theory async&#x2F;await should NOT be the same as spinning up a new thread (across most languages). It&#x27;s just suspending that closure on the current thread and coming back around to it on the next loop of that existing thread. It makes certain data reads and writes safe in a way that multithreading doesn&#x27;t. However, as noted in article, it is possible to eject a task onto a different thread and then deal with data access across those boundaries. But that is an enhancement to the model, not the default.
    • jen203 hours ago
      EDIT: Seems like newer versions of Xcode change the Swift language defaults here, but that is just the IDE, not the language (and Swift Package Manager does not appear to do the same!)<p>I&#x27;d argue the default is that work _does_ move across system threads, and single-threaded async&#x2F;await is the uncommon case.<p>Whether async &quot;tasks&quot; move across system threads is a property of the executor - by default C#, Swift and Go (though without the explicit syntax) all have work-stealing executors that _do_ move work between threads.<p>In Rust, you typically are more explicit about that choice, since you construct the executor in your &quot;own&quot; [1] code and can make certain optimizations such as not making futures Send if you build a single threaded one, again depending on the constraints of the executor.<p>You can see this in action in Swift with this kind of program:<p><pre><code> import Foundation for i in 1...100 { Task { let originalThread = Thread.current try? await Task.sleep(for: Duration.seconds(1)) if Thread.current != originalThread { print(&quot;Task \(i) moved from \(originalThread) to \(Thread.current)&quot;) } } } RunLoop.main.run() </code></pre> Note to run it as-is you have to use a version of Swift &lt; 6.0, which has prevented Thread.current being exposed in asynchronous context.<p>[1]: I&#x27;m counting the output of a macro here as your &quot;own&quot; code.
  • ChrisMarshallNY2 hours ago
    This looks like it&#x27;s well-written and approachable. I&#x27;ll need to spend more time reviewing it, but, at first scan, it looks like it&#x27;s nicely done.
  • halfmatthalfcat4 hours ago
    I loved the idea of Swift adopting actors however the implementation seems shoehorned. I wanted something more like Akka or QP&#x2F;C++...
    • Someone3 hours ago
      I feel the reverse. I can see one can claim Swift has everything but the kitchen sink, but its actors, to me, don’t look shoehorned in.<p>Reading <a href="https:&#x2F;&#x2F;docs.swift.org&#x2F;swift-book&#x2F;documentation&#x2F;the-swift-programming-language&#x2F;concurrency&#x2F;#Actors" rel="nofollow">https:&#x2F;&#x2F;docs.swift.org&#x2F;swift-book&#x2F;documentation&#x2F;the-swift-pr...</a>, their first example is:<p><pre><code> actor TemperatureLogger { let label: String var measurements: [Int] private(set) var max: Int init(label: String, measurement: Int) { self.label = label self.measurements = [measurement] self.max = measurement } } </code></pre> Here, the ‘actor’ keyword provides a strong hint that this defines an actor. The code to call an actor in Swift also is clean, and clearly signals “this is an async call” by using <i>await</i>:<p><pre><code> await logger.max </code></pre> I know Akka is a library, and one cannot expect all library code to look as nice as code that has actual support from the language, but the simplest Akka example seems to be something like this (from <a href="https:&#x2F;&#x2F;doc.akka.io&#x2F;libraries&#x2F;akka-core&#x2F;current&#x2F;typed&#x2F;actors.html" rel="nofollow">https:&#x2F;&#x2F;doc.akka.io&#x2F;libraries&#x2F;akka-core&#x2F;current&#x2F;typed&#x2F;actors...</a>):<p><pre><code> object HelloWorld { final case class Greet(whom: String, replyTo: ActorRef[Greeted]) final case class Greeted(whom: String, from: ActorRef[Greet]) def apply(): Behavior[Greet] = Behaviors.receive { (context, message) =&gt; context.log.info(&quot;Hello {}!&quot;, message.whom) message.replyTo ! Greeted(message.whom, context.self) Behaviors.same } } </code></pre> I have no idea how naive readers of that would easily infer that’s an actor. I also would not have much idea about how to use this (and I _do_ have experience writing scala; that is not the blocker).<p>And that gets worse when you look at Akka http (<a href="https:&#x2F;&#x2F;doc.akka.io&#x2F;libraries&#x2F;akka-http&#x2F;current&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;doc.akka.io&#x2F;libraries&#x2F;akka-http&#x2F;current&#x2F;index.html</a>). I have debugged code using it, but still find it hard to figure out where it has suspension points.<p>You may claim that’s because Akka http isn’t good code, but I think the point still stands that Akka allows writing code that doesn’t make it obvious what is an actor.
    • jen203 hours ago
      &gt; I wanted something more like Akka<p><a href="https:&#x2F;&#x2F;github.com&#x2F;apple&#x2F;swift-distributed-actors" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;apple&#x2F;swift-distributed-actors</a> is more like Akka, but with better guarantees from the underlying platform because of the first-class nature of actors.
    • whalesalad2 hours ago
      Any sufficiently complicated concurrent program in another language contains an ad hoc informally-specified bug-ridden slow implementation of half of Erlang.<p>- Robert Virding
    • troupo3 hours ago
      &gt; the implementation seems shoehorned.<p>Because it&#x27;s extremely hard to retrofit actors (or, really, any type of concurrency and&#x2F;or parallelism) onto a language not explicitly designed to support it from scratch.
    • ModernMech3 hours ago
      This is my feeling as well. It feels to me that based on the current product, Swift had two different designers: one designer who felt swift needed to be a replacement for Objective C and therefore needed to feel like a spiritual successor to that language, which meant it had to be fundamentally OOP, imperative, and familiar to iOS devs; and another designer who wanted it to be a modern functional, concurrent language for writing dynamic user interfaces with an advanced type checker, static analysis, and reactive updates for dynamic variables.<p>The end result is a language that brings the worst of both worlds while not really bringing the benefits. An example I will give is SwiftUI, which I absolutely hate. You&#x27;d think this thing would be polished, because it&#x27;s built by Apple for use on Apple devices, so they&#x27;ve designed the full stack from editor to language to OS to hardware. Yet when writing SwiftUI code, it&#x27;s very common for the compiler to keel over and complain it can&#x27;t infer the types of the system, and components which are ostensibly &quot;reactive&quot; are plagued by stale data issues.<p>Seeing that Chris Lattner has moved on from Swift to work on his own language, I&#x27;m left to wonder how much of this situation will actually improve. My feeling on Swift at this point is it&#x27;s not clear what it&#x27;s supposed to be. It&#x27;s <i>the</i> language for the Apple ecosystem, but they also want it to be a general purpose thing as well. My feeling is it&#x27;s never <i>not</i> going to be explicitly tied to and limited by Apple, so it&#x27;s never really going to take off as a general purpose programming language even if they eventually solve the design challenges.
  • isodev3 hours ago
    I really don&#x27;t know why Apple decided to substitute terms like &quot;actor&quot; and &quot;task&quot; with their own custom semantics. Was the goal to make it so complicated that devs would run out of spoons if they try to learn other languages?<p>And after all this &quot;fucking approachable swift concurrency&quot;, at the end of the day, one still ends up with a program that can deadlock (because of resources waiting for each other) or exhaust available threads and deadlock.<p>Also, the overload of keywords and language syntax around this feature is mind blowing... and keywords change meaning depending on compiler flags so you can never know what a code snippet really does unless it&#x27;s part of a project. None of the safeties promised by Swift 6 are worth the burnout that would come with trying to keep all this crap in one&#x27;s mind.
    • hn-acct3 hours ago
      Do people actually believe that there are too many keywords? I’ve never met a dev irl that says this but I see it regurgitated on every post about Swift. Most of the new keywords are for library writers and not iOS devs.<p>Preventing deadlock wasn’t a goal of concurrency. Like all options - there are trade offs. You can still used gcd.
      • isodev2 hours ago
        &gt; Do people actually believe that there are too many keywords?<p>Yes they do. Just imagine seeing the following in a single file&#x2F;function: Sendable, @unchecked Sendable, @Sendable, sending, and nonsending, @conccurent, async, @escaping, weak, Task, MainActor.<p>For comparison, Rust has 59 keywords in total. Swift has 203 (?!), Elixir has 15, Go has 25, Python has 38.<p>&gt; You can still used gcd.<p>Not if you want to use anything of concurrency, because they&#x27;re not made to work together.
        • dagmx1 hour ago
          Most of your listed examples aren’t keywords though. They’re built in types or macro decorators.
        • saagarjha2 hours ago
          Task and MainActor are types.
          • isodev2 hours ago
            So?
            • dagmx1 hour ago
              If you’re including types, you’d hit the many hundreds if not thousands in most languages.<p>It dilutes any point you were trying to make if you don’t actually delineate between what’s a keyword and a type.
            • jen201 hour ago
              So... they aren&#x27;t keywords.<p>Swift does indeed have a lot of keywords [1], but neither Task or MainActor are among them.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;swiftlang&#x2F;swift-syntax&#x2F;blob&#x2F;main&#x2F;CodeGeneration&#x2F;Sources&#x2F;SyntaxSupport&#x2F;KeywordSpec.swift#L74-L281" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;swiftlang&#x2F;swift-syntax&#x2F;blob&#x2F;main&#x2F;CodeGene...</a>
              • isodev1 hour ago
                I never said they’re keywords. Y’all way too focused on defending Apple at all cost.
  • Invictus03 hours ago
    @dang I think it&#x27;s important that &quot;fucking&quot; remains in the title
    • JKCalhoun3 hours ago
      (It certainly makes it easier to find the topic some time after when going back to search for it on HN.)
  • dang1 hour ago
    (We don&#x27;t have a problem with profanity in general but in this case I think it&#x27;s distracting so I&#x27;ve de-fuckinged the title above. It&#x27;s still in the sitename for those who care.)