[Mesa-dev] Rust drivers in Mesa

timur.kristof at gmail.com timur.kristof at gmail.com
Sat Oct 3 00:32:21 UTC 2020


On Fri, 2020-10-02 at 18:21 -0500, Jason Ekstrand wrote:
> > The good thing about C++ is that you can pick a subset of features
> > that
> > you like, and stick to them. Then you'll never have to deal with
> > other
> > the stuff if you don't want to. There exists a subset of the
> > language
> > which helps get rid of most memory management issues.
> 
> The difficulty in Mesa has always been deciding what that subset is.
> This thread is proof of that.  So far we've had people extole
> everything from basic type safety and memory management to template
> meta-programming.  Features which one developer enjoys another
> loathes.  This is why we tend to stick to C for the core: It's
> limited
> but those limitations we can sort-of all agree on it.

Yes, the bad thing about C++ is that it has a lot of baggage.

Sometimes I find myself enjoying writing C more, because then I get to
spend more time on the actual problems I'm solving. In C++ there are a
lot of ways to do everything so I have to think more about which fits
the task at hand best.

My only problem with C is that it lacks something like the STL which
means that every project has to reinvent the wheel to some degree; and
that it lacks things like generics, so there isn't a good way to avoid
repetitive code.

> IMO: Like many modern languages, Rust has a defined default coding
> style and It's pretty reasonable.  We should just go with it.

Fair point.

> > That said, I think it's perfectly okay to give it a try, write a
> > backend compiler in Rust and see what happens. However, I don't
> > think
> > it is feasible or desireable to rewrite complicated parts from
> > C/C++ to
> > Rust. I think Daniel Steinberg's thoughts apply:
> > https://daniel.haxx.se/blog/2017/03/27/curl-is-c/
> 
> Same.  Different developers/teams make different choices in their
> drivers and back-ends all the time.  Some use C++ while others stickk
> to C.  They all have different coding styles and choose different C++
> feature sets (when they use C++).  IMO, the choice to use a language
> like Rust is no different.  As long as it doesn't cause a giant
> project-wide problem, I'm fine with it.

Yeah, nothing wrong with that.
I'll be curious to see how it turns out.

- Tim



More information about the mesa-dev mailing list