Andreas Kling aka @awesomekling wrote:

We’ve been evaluating a number of C++ successor languages for @ladybirdbrowser , and the one best suited to our needs appears to be @SwiftLang 🪶

Over the last few months, I’ve asked a bunch of folks to pick some little part of our project and try rewriting it in the different languages we were evaluating. The feedback was very clear: everyone preferred Swift!

Why do we like Swift?

First off, Swift has both memory & data race safety (as of v6). It’s also a modern language with solid ergonomics.

Something that matters to us a lot is OO. Web specs & browser internals tend to be highly object-oriented, and life is easier when you can model specs closely in your code. Swift has first-class OO support, in many ways even nicer than C++.

The Swift team is also investing heavily in C++ interop, which means there’s a real path to incremental adoption, not just gigantic rewrites.

Strong ties to Apple?

Swift has historically been strongly tied to Apple and their platforms, but in the last year, there’s been a push for “swiftlang” to become more independent. (It’s now in a separate GitHub org, no longer in “apple”, for example).

Support for non-Apple platforms is also improving, as is the support for other, LSP-based development environments.

What happens next?

We aren’t able to start using it just yet, as the current release of Swift ships with a version of Clang that’s too old to grok our existing C++ codebase. But when Swift 6 comes out of beta this fall, we will begin using it!

No language is perfect, and there are a lot of things here that we don’t know yet. I’m not aware of anyone doing browser engine stuff in Swift before, so we’ll probably end up with feedback for the Swift team as well.

I’m super excited about this! We must steer Ladybird towards memory safety, and the first step is selecting a successor language that we can begin adopting very soon. 🤓🐞

    • AllNewTypeFace@leminal.space
      link
      fedilink
      arrow-up
      30
      arrow-down
      5
      ·
      5 months ago

      Not necessarily. The language itself is implemented on LLVM and compiles to a variety of backends, and can interoperate with C and C++ (including presenting C++ classes and STL types in its type system). Toolchains exist for Windows and Linux, as well as Apple platforms, and porting them to other POSIX-like OSes shouldn’t be too hard. The core of the language and its Foundation runtime library are open-source and cross-platform; it’s only macOS/iOS APIs and higher-level frameworks built on them like SwiftUI which are proprietary. Swift is in use on non-Apple platforms: there’s the Kitura web framework, which gets deployed mostly on Linux, and someone has recently used it to write games for the PlayDate handheld console.

      In general, I can’t fault his rationale there. Swift has more modern language features (such as an expressive type system) than Go, is not quite as fiddly as Rust, isn’t a trainwreck of incompatible levels of abstraction like C++, and has developer momentum behind it unlike Dart.

      • RoyaltyInTraining@lemmy.world
        link
        fedilink
        arrow-up
        6
        arrow-down
        2
        ·
        5 months ago

        Reading that really makes me want to give it a go. If swift’s package management is anything like Rust or Go, I could see myself enjoying it

        • AllNewTypeFace@leminal.space
          link
          fedilink
          arrow-up
          2
          ·
          5 months ago

          As of a few years ago, Swift has a package management system named, creatively enough, Swift Package Manager, which can install and build dependencies. It uses Git repository links rather than a central Cargo-style package database, though.

    • Tekhne@sh.itjust.works
      link
      fedilink
      arrow-up
      7
      arrow-down
      2
      ·
      5 months ago

      I’ve worked with Swift a bunch for Apple platforms, am mildly familiar with how it works on other platforms. It should be able to compile on a wide host of platforms with minimal/no issues. The runtime dependencies are localized to Apple platforms, and I think the dominant UI toolkit on other platforms is a Swift port of qt. So it should be just fine?

    • kenkenken@kbin.run
      link
      fedilink
      arrow-up
      8
      arrow-down
      22
      ·
      5 months ago

      Probably to be a cross platform wide-adopted browser is not the goal, and the author hopes to find a niche userbase amongst conservative macOS users to feed his narcissism.

      • ggppjj@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        edit-2
        5 months ago

        What?

        I mean this sincerely, I’ve been loosely following this project and the OS it is from and would like to know more about what you know, because this is the first time I’ve heard such accusations.

        • livingcoder@programming.dev
          link
          fedilink
          arrow-up
          3
          arrow-down
          3
          ·
          edit-2
          5 months ago

          It’s a reference to this: https://github.com/SerenityOS/serenity/pull/6814#issuecomment-830793992

          They have a phobia of making changes that are valid if they perceive the change to be motivated by politics. In the example above, the PR is denied because they have been convinced that the PR is about accommodating trans people. The existence of trans people and accommodating them via grammar is political for certain kinds of conservatives. The irony is that their own political beliefs are affecting their ability to distinguish a valid change from a politically-motivated one.

          • Mia@lemmy.blahaj.zone
            link
            fedilink
            arrow-up
            3
            ·
            edit-2
            4 months ago

            It wasn’t just to accomodate trans people but just… anyone who isn’t male? Apparently women being software developers is a controversial concept for Andreas.

          • LeFantome@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            4 months ago

            This is a risky comment I know but projecting the politics of “certain kinds of conservatives” onto a Swedish person feels political to me. Why do we feel we know his thought? Certainly not because of the political climate elsewhere I hope.

            After reading the SerenityOS comment, I find it a lot easier to believe that he thought following the long history of apolitical norms in language use was the safe, non-political option. Little did he know?

            I realize that many people now see “historical norms” as implicitly tainted by adjacent beliefs that many also have been present historically. That is fine. Go ahead and change the language. Language evolution is natural. I have no problem with that. But can we not also acknowledge that many people simply learned to use language within a context that had nothing to do with these issues? Isn’t “lack of awareness” or even “lack of a position” a more likely explanation than “sides with the enemy”.

            I see no evidence that the SerenityOS guy himself meant anything political. I do not believe that I can tell his stance on trans issues at all from what he said. And that is the problem.

            Insisting that other people that do not share your passion for language reform are anything other than neutral to your issues is very political. You are projecting some very unkind attributes onto somebody that does not deserve that treatment.

            How is persecution of others a valid way to defend a minority? All I see is one innocent comment asking to be left out of a political debate and then months or years of aggressive attacks in response. Has he even responded to these attacks?

            At the time the comment was written, I think it could have been included in the project or not and it would have meant nothing either way. As somebody that believes trans people are just people, it honestly would not have occurred to me to object to either text.

            Frankly, the level of vitriol that has been directed towards him totally vindicates his initial comment. The level of politics is absurd. I am quite sure that many people witnessing these attacks are turned off. Some that were previously pretty neutral have probably been driven away. Others will fear “trans” as a dangerous, radical movement.

            What is the actual goal here? It cannot actually be harmony and inclusion. Nobodycould be pushing that so ineffectively.

            • livingcoder@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              4 months ago

              This comment would make sense if he hadn’t stated that the PR was politically biased but had instead said that it was unnecessary or that it would be inconsistent with the vast majority of the documentation. I’m just reading what he said. He claimed it was a PR based on politics, not language norms or historical norms. Only certain kinds of conservatives view gender-inclusive language as a political issue.

              I appreciate that you don’t want to see this person as a hateful bigot and I don’t think he is either. Most people I’ve encountered that share the same reaction as him have basically been tainted by conservative influences, like media or parents, but they don’t have any real hate for trans people in their hearts. They’ve associated the idea of gender-inclusivity as being political and moved on with their lives, accepting the framing and narratives around the topic.