Live data from Hacker News

Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

risingwave-labs.com

251–260 of 307 posts

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#251

Fascinating how defensive C++ lifers can be. Rust builds on the knowledge of decades of C++ programming. It’s basically a compiler enforced set of C++ best practices. It’s strange how hostile some in the C++ community are to Rust.

You have to remember that we die. So what you learn til 30, say, you capitalise on till 70, and then you retire & die. There isn't another live to live until 30 "again", and then be within the Rust culture. Rust has, by analogy, stapled it's "Ninety-five Theses to the door" of C++ and those C++atholics are afraid their way of life is ending before they do.

>"So what you learn til 30, say, you capitalise on till 70, and then you retire & die."

False BS

>"those C++atholics are afraid their way of life is ending before they do"

We are into insults area now.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#252

Earlier quoted context omitted.

I agree with the macro part. I have seen people use macros instead of functions as a way to escape the type system. But it's not a problem that comes up with C++ programmers.

Don't templates provide similar functionality in C++?

Templates are needed in C++ for compile time polymorphism. Rust is able to do that without macros with generics.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#253

Earlier quoted context omitted.

I was happy to see this as well. As a 'seasoned' C++ dev myself, when I learned Rust, I was pleasantly surprised to see those implicit concepts made explicit in code.

Same. I think that I didn't go through the Rc phase that so many new to Rust go through because of C++ teaching me the same lessons in a much more brutal way. By the time I got to Rust I had learned to structure my code to sort of use pointers/references as capabilities, such that simply having knowledge of the bit pattern of the pointer was implicit access through that pointer since as a codebase evolves someone wil…

What I love about Rust is what I love about Python… “explicit is better than implicit”

When I open something up to read it, to try and understand it, to dig in and fix something broken… having everything be exposed in the explicitly written code… is vastly more useful to me than trying to mentally interpret a language as I read it and remember the rules, the meta-programming rules… and all the implicit stuff that can affect how the program will behave.

Lot of programming languages aren’t good at this explicitness, and I’ll be honest, it’s a genuine struggle for me picking up the languages like this, only made worse when the documentation is very prose like and fails to convey how anything actually works, eschewing that in favour of, at length, demonstrating the feel of a programming language through countless demonstration example that lack mechanical “what is this doing under the hood” explanation.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#254

Earlier quoted context omitted.

Yeah, sadly it is. With e.g. Elixir I can literally get into a REPL and prototype my solution in minutes, right there on the spot, and then just copy a few lines from it and have the solution be 90% done (minus tests, of course). With Go and Rust I have to make a dedicated function somewhere and then have it be called after starting the program. Ain't exactly rocket science but the difference in time to do it and the…

I love the idea of Elixir, but I just can't get into it because of its weird choice of sigils. |> for pipes and <- for assignments, seriously? I seriously dislike programming languages which choose two character sigils for basic operations. I also heavily dislike |x| in Rust.

Minor clarification: Elixir uses = for assigment. There's a special construct called "with" that's basically fallible pipes, and that's probably where you saw
    with {:ok, id} 
            # We reach this if either get_id or get_val fails
            show_error(e)
    end

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#255

Earlier quoted context omitted.

> It’s basically a compiler enforced set of C++ best practices. It’s strange how hostile some in the C++ community are to Rust. Well, the syntax is alien and new, it doesn't do OO the way 9 out of 10 working developers expect it to, almost all C++ popular design patterns have to be rejected, many of the claims("fearless concurrency") are exaggerated and the Rust evangelists are really really toxic when referring to C…

OOP is not C++ best practice these days. For me C++ best practice is: - Smart pointers - auto and const references all over the place - RAII - Pure data structs - Free functions - A little bit of templating but not too crazy Modern C++ reads a bit like JavaScript strangely!

There is no "best practice". It depends on context. OOP is good for some things and not that much for others. Same goes for your list of "best" practices. Dismissing a paradigm in totality because some Joe Shmoe of today has declared it non cosher looks rather more like a religious statement than a practical choice.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#256

Earlier quoted context omitted.

Yeah, sadly it is. With e.g. Elixir I can literally get into a REPL and prototype my solution in minutes, right there on the spot, and then just copy a few lines from it and have the solution be 90% done (minus tests, of course). With Go and Rust I have to make a dedicated function somewhere and then have it be called after starting the program. Ain't exactly rocket science but the difference in time to do it and the…

I love the idea of Elixir, but I just can't get into it because of its weird choice of sigils. |> for pipes and <- for assignments, seriously? I seriously dislike programming languages which choose two character sigils for basic operations. I also heavily dislike |x| in Rust.

Even F# uses |> for pipes and Rlang uses <- for assignments. This is not a Elixir only thingy.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#257

Earlier quoted context omitted.

Rust could avoid it through the Box abstraction that afaik assumes not having a nullptr

It would not. Rust needs ASAN/UBSAN/TSAN/MSAN sanitizers for a reason.

Can you point me to any significant primarily rust codebase that runs sanitizers? I've never heard of that. Unless you mean miri.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#258

Earlier quoted context omitted.

See this is what I’m scared about in my current job. We have some people who want to use dynamically typed languages and some who want to use static. I don’t think being able to brain dump code is a good thing and it leads to an unmanageable mess when you have a large codebase. Types are essential as far as I’m concerned, but I constantly have to get into arguments with the dynamic type fans because their “flow” Is b…

Be a bit more charitable. :) Brain-dumping is simply a way to iterate and figure out what works and what doesn't, quickly. After I do it I take the requisite time to emulate exhaustive pattern matching, and add tests that cover the functionality well. My problem with Rust, and I love the language a lot, is exactly this: I want to quickly find what would work. After that I'm very happy to take the proper time to go th…

Rust needs an interpreter mode for fast-turnaround of brain dump

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#259

Earlier quoted context omitted.

Be a bit more charitable. :) Brain-dumping is simply a way to iterate and figure out what works and what doesn't, quickly. After I do it I take the requisite time to emulate exhaustive pattern matching, and add tests that cover the functionality well. My problem with Rust, and I love the language a lot, is exactly this: I want to quickly find what would work. After that I'm very happy to take the proper time to go th…

Rust needs an interpreter mode for fast-turnaround of brain dump

Yep, I definitely wouldn't refuse one.

Re: Building a Cloud Database from Scratch: Why We Moved from C++ to Rust (2022)

#260

Earlier quoted context omitted.

> ...it has a much better user story around build & package/module/library management Cargo sure does, but support for rust outside of cargo is much, much worse than equivalent support for C and C++. It doesn't matter for self-contained projects like simple Makefile ones, but at large scales, moving everything to cargo doesn't seem reasonable right now. Maybe eventually?

This is the one issue I personally have with C++. How do I `pip install boost`?

Note that a lot of the pip projects are implemented in C++. You install packages for the environment you are targeting.

A lot of folks use Conan or vcpkg for pure C++ dev.

Post reply on HN