this post was submitted on 12 Aug 2024
165 points (92.7% liked)

Programming

17333 readers
241 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

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. 🤓🐞

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 30 points 2 months ago (3 children)

Swift was developed by a lot of former C++ committee members, and in C++ circles they’ve been advocating for it as a “successor language” for quite some time.

This could definitely be confusing if you don’t have that context, but making Swift useful for this kind of project has been an explicit goal of the Swift developers for years.

[–] [email protected] 5 points 2 months ago (1 children)

How have they been advocating that? This is the first I'm hearing about any of this...

[–] [email protected] 1 points 2 months ago (1 children)

IDK, but D is probably a better "successor language" for C++ than Swift. The lack of corporate support is both a curse and a blessing: What it lacks in money makes up in no "hype-bust" cycles, thus we don't have to jump on various bandwagons and programming trends can be easier written off as just trends (e.g. we dodged a bullet by never going through a "const by default" suggestion).

[–] [email protected] 1 points 2 months ago

I have wanted to like D for so long but it has just not been able to create a cohesive story outside its own bubble. It feels like it is going nowhere. Certainly, given its ages, there is no obvious path to popularity.

[–] [email protected] 0 points 2 months ago