Why not incrementally convert it to modern C++?
I don't write C++ though I have written some C. I imagine it's easier to shoot yourself in the foot with C++ compared to Rust; it's specifically designed to be a safe language, whereas C++ had things like auto_ptr added Why have a half-way solution of porting to modern C++ when you can just write it in Rust?
Apple is looking for engineers to convert its code from C to Rust
211–220 of 240 posts
Re: Apple is looking for engineers to convert its code from C to Rust
#212Earlier quoted context omitted.
For what it's worth, I used to be big on C, and grew to very dislike C++ (because it's simple insane). Rust is my language of choice for years now. IMO, Rust shares the same inner-simplicity that C has, but combined with ability to build and use bulletproof higher-level abstractions. The same way I roughly knew what machine instructions (roughly) my C code produces, I know what machine instructions my Rust code produ…
Rust definitely does not share the simplicity of C. It is the equivalent of C++, not C. You can write code which you cannot guess the machine code, as soon as you use any of the abstractions, just like C++.
Re: Apple is looking for engineers to convert its code from C to Rust
#213Earlier quoted context omitted.
This sort of standard seems hard to meet for any language, if the bar is "all abstractions should be included and zero-cost." In practice, you probably write a specialized quicksort for a given type in C to work around the lack of generic quicksort. You do this in the same way you manually convert your suspendable forkable computations into a struct that has all your "local variables" and an "instruction counter" ins…
So there's an intrinsic cost to abstractions: namely that by using an abstraction, you're not specializing to the optimal extent possible; your general-purpose algorithm may well be close to ideal, but various details will not be; and even in languages that support specialization, you're likely to end up in a not quite optimal solution. But that's not what people usually mean with zero-cost, right? They mean that ass…
Lots of other languages make it way easier than C to write "fused quicksort". Although it doesn't pay much regard to programming language theory, Jai is another interesting language in this area, made by a guy who's mostly concerned with being able to express the fully specialized/fused version of everything without creating extra work for the programmer.
Re: Apple is looking for engineers to convert its code from C to Rust
#214Any thoughts on why they’d be using Rust rather than Swift for this work?
If you're writing performance sensitive code and/or correct code, Rust makes more sense. Rust makes more sense for almost any use-case over Swift unless you're building Apple clients. Swift still hasn't really escaped its niche of being a language for end-users to build clients for the Apple ecosystem with trade-offs in mind for those end-users who are just building clients (rather than, say, implementing a safer ope…
I wouldn’t build network software in Swift.
Re: Apple is looking for engineers to convert its code from C to Rust
#215I'd love a Rust job, but there are so few roles out there, nearly everything is Javascript/Python/Java. Is it worth even learning?
IMHO it's worth learning at least to internalize the concept of ownership. Ownership in some form exists in most languages, but Rust makes it very explicit. It guides you towards clearly organizing program's data into isolated tree-like structures, instead of a web of everything referencing everything else. Like Lisp, even if you don't use it, it may change how you think about code. I see companies adopting Rust inte…
I think you might be over-stating this. We do write a bunch of Rust though!
Re: Apple is looking for engineers to convert its code from C to Rust
#216Earlier quoted context omitted.
> If you aim for performance, "pretty good" doesn't cut it. It does in the overwhelming majority of real cases.
But not at the trillion dollar company that is Apple, which is what we are talking about
Re: Apple is looking for engineers to convert its code from C to Rust
#217Earlier quoted context omitted.
You reduce it by using custom routing ASICs that can handle orders of magnitude more traffic than a CPU with equal or lower power consumption. To put things into perspective: Cisco’s latest routing ASIC — the Cisco Silicon One — can handle 10.8 Tbps (in fixed mode). I’m sure Google and others have evaluated this, but it’s just kind of surprising that they opt to do per-packet processing in software. Disclaimer: I wri…
but getting from 0..custom-asic is waay more harder than you make it out :o) plus you have a _custom_ stack on top of it, which is not malleable at all. moreover, getting a vendor lockin is probably not such a good idea anyways. giving credit where it is due, intel's role in development of latest pcie-4.0 and upcoming pcie-5.0 specs and ofcourse the latest cpu's make it less and less appealing to consider putting up…
Even if you utilize every last cycle of CPU, the price/bps and energy/bit will still be way higher than almost any switching or routing ASIC on the market.
Re: Apple is looking for engineers to convert its code from C to Rust
#218Earlier quoted context omitted.
But not at the trillion dollar company that is Apple, which is what we are talking about
Even for Apple, if "pretty good" performance were the price of avoiding another "goto fail" then it should be more than worth it.
But the reason companies as large as apple care so much about performance is because at their scale a 10% difference can easily mean 100,000 physical servers. So they do go to insane lengths to avoid "pretty good"
Re: Apple is looking for engineers to convert its code from C to Rust
#219Earlier quoted context omitted.
> but I doubt someone would be willing to trade California's winter for Alberta's, regardless of the job. I was just down around the LA area, and I'll gladly take -40 winters for the rest of my life than deal with that traffic and air pollution.
That's why they invented Santa Monica.
You'll be shocked.
Re: Apple is looking for engineers to convert its code from C to Rust
#220Earlier quoted context omitted.
You do understand that you're replying to the founder of D, right? Walter put his whole life into D. Can we please show a little compassion for someone's life's work?
> Walter put his whole life into D. Can we please show a little compassion for someone's life's work? While I appreciate the kind words, I am not looking for compassion. D must stand entirely on its own merits. D has already succeeded quite spectacularly: 1. we have a wonderful D community which has been utterly indispensible 2. D is part of the Gnu Compiler Collection 3. D has been accepted into the HOPL conference,…
TDPL sits next to KNR on my shelf