top | item 47068488

(no title)

meisel | 11 days ago

Why did Ladybird even attempt this with Swift, but (I presume) not with Rust? If they're going to go to the trouble of adding another language, does Rust not have a better history of C++ interop? Not to mention, Swift's GC doesn't seem great for the browser's performance.

discuss

order

mlinksva|11 days ago

https://x.com/awesomekling/status/1822236888188498031 https://x.com/awesomekling/status/1822239138038382684 "In the end it came down to Swift vs Rust, and Swift is strictly better in OO support and C++ interop."

archargelod|10 days ago

Did they consider using Nim? It has great C++ interop, OO and same ARC memory management as in Swift.

ckcheng|11 days ago

> In the end it came down to Swift vs Rust, and Swift is strictly better in OO support and C++ interop

Why not D?

refulgentis|11 days ago

> Swift is strictly better in OO support and C++ interop

Fascinating.

They've shown the idea it is better on C++ interop is wrong.

I don't know enough to say Rust has same OO support as Swift, but I'm pretty sure it does. (my guess as a former Swift dev: "protocol oriented programming" was a buzzy thing that would have sounded novel, but amounted to "use traits" in rust parlance)

EDIT: Happy to hear a reply re: why downvotes, -3 is a little wild, given current replies don't raise any issues.

diath|11 days ago

> Why did Ladybird even attempt this with Swift, but (I presume) not with Rust? I

Probably the same reason why Rust is problematic in game development. The borrow checker and idiomatic Rust do not go well together with things that demand cyclic dependencies/references. Obviously there are ways around it but they're not very ergonomic/productive.

lukeh|11 days ago

Swift actually has excellent C++ interop [1] (compared to other languages, but, I guess, not good enough for Ladybird).

[1] https://www.swift.org/documentation/cxx-interop/

palata|11 days ago

I actually looked into that recently (calling C++ from Swift), and I was surprised by the amount of limitations.

Said differently: the C++ interop did not support calling the C++ library I wanted to use, so I wrote a C wrapper.

jll29|11 days ago

Andreas Kling said Rust lacks OO, which he says is useful for GUI coding.

He even made an attempt at creating his own language, Jakt, under SerenityOS, but perhaps felt that C++ (earlier with, now without Swift) were the pragmatic choice for Ladybird.

stingraycharles|11 days ago

But wasn’t Rust designed specifically for being a language for developing a rendering engine / web browser?

password4321|11 days ago

It will be interesting to see any further justification; I believe Rust was rejected previously because of the DOM hierarchy/OOP but not sure IIRC.

20240810 https://news.ycombinator.com/item?id=41208836 Ladybird browser to start using Swift language this fall

gardaani|11 days ago

Here's Andreas Kling's general thoughts on Rust:

- Excellent for short-lived programs that transform input A to output B

- Clunky for long-lived programs that maintain large complex object graphs

- Really impressive ecosystem

- Toxic community

https://x.com/awesomekling/status/1822241531501162806

alper|11 days ago

I think that's fair. Funny to have a language that makes it prohibitively difficult to use most of the core computer science constructs (lists, graphs etc.).

bergheim|11 days ago

I so wholeheartedly agree. You are making a new web browser - akin to a new OS - and you want it open source for everybody but you choose swift not rust?

rvz|11 days ago

This experiment has shown that both are actually bad choices.

carefree-bob|11 days ago

The ladybird developers tried Rust and Swift both and voted to adopt Swift.

elcritch|11 days ago

Also I believe one of the core LadyBird devs was an ex Apple employee on WebKit which has been using Swift as well.

LeFantome|11 days ago

The Ladybird founder was one of the original KHTML devs and worked on Safari at Apple.

saagarjha|11 days ago

I’m not even sure he was at Apple when Swift came out. WebKit integration is very recent.

generalpf|10 days ago

Swift doesn't use a garbage collector.

myko|6 days ago

ARC is GC, Swift definitely uses GC.

It isn't a _tracing_ GC

ozgrakkurt|10 days ago

I remember watching the project lead say something like “the developers just don’t enjoy rust”