News for hackers. Stuff that matters.
Re:D as a Better C by steveklabnik on Wednesday August 23, 2017 @07:34PM (#15086195)
> I don't know how Rust's RAII deals with exceptions thrown by lower level code.

Unwinding across an FFI boundary is considered undefined behavior.

https://doc.rust-lang.org/reference/behavior-considered-unde... last bullet point.

Re:D as a Better C by WalterBright on Wednesday August 23, 2017 @08:56PM (#15086727)
That's exactly what I wanted to know. Thanks!

Full D is compatible with foreign exceptions and unwinding. I'll see about making D as Better C also compatible, but I suppose Rust's precedent makes it acceptable to not handle it.

Re:D as a Better C by steveklabnik on Wednesday August 23, 2017 @08:59PM (#15086746)
No problem!

This isn't my super strong area of expertise, but don't you have to specify how the unwinding works? I believe this is part of the reason why Rust punted; you'd have to specify exactly what kind is supported. (Rust uses libunwind for panics, incidentally.)

Re:D as a Better C by WalterBright on Wednesday August 23, 2017 @09:10PM (#15086818)
The how is handled by providing a language-specific "personality" function in the generated exception tables. The D runtime library has one for D. But with D as Better C, I'd have to find a way to make the C personality function work for D.
Re:D as a Better C by steveklabnik on Wednesday August 23, 2017 @10:51PM (#15087261)
Ah right, makes sense. Thanks :)