Conversation

Lorenzo Stoakes

Lots of actually quite delightful stuff in the mm rust code I looked at... god almighty, to have actually strong types, to have guards and a sense of actual _lifetimes_ of things...

Like being in the 21st century or something! ;)
1
0
4

@ljs if by "guard" you mean locks that get auto-dropped when leaving a scope: there are some corners of kernel code that use C extensions to also get that feature, search for "guard" and "scoped_guard". I am kinda torn on that - it makes errors with imbalanced lock/unlock operations less likely and is more concise, but it can also make it hard to see that a lock is being dropped when you don't see that explicitly being done

1
0
1
@jann I really hate some of this macro stuff to be honest, it is a bit of a bolted on horrible mess in the wild.

There's also the CLASS() stuff which I find kinda horrid.

And of course you then lose all the lifetime/borrow checker stuff.

I'd rather we keep doing expected C things in C...
1
0
2

@ljs @jann Honestly curious here, no matter the syntactic sugar, in the end RAII (what a really bad name) it all ends up looking the same, so what don't you like about the C version?
Just the fact that it's unexpected in C?

1
0
0

@ljs @jann Ah yeah well surely can't say much about that indeed. I do still see the value in autorelease like macros but I guess this falls into the bikeshed territory pretty fast.

0
0
0