Re:RustBelt: securing the foundations of the Rust programmin...
by steveklabnik on Sunday February 04, 2018 @03:29PM
(#16304724)
You can, but there is a big difference: betterC is a subset of D, whereas unsafe Rust is a superset of safe Rust. That is, when you use unsafe, you don't lose any language features. When you drop into betterC, you do lose a bunch of stuff from D.
[ Parent
| on HN ]
Re:RustBelt: securing the foundations of the Rust programmin...
by dawg on Sunday February 04, 2018 @05:42PM
(#16305389)
You don't have to restrict yourself to betterC to use manual memory management. BetterC is mainly targetted at embedded programming and to port components of existing C applications. Malloc vs. GC vs. stdx-allocator is a separate topic, though betterC doesn't link with the GC by default.
Re:RustBelt: securing the foundations of the Rust programmin...
by steveklabnik on Sunday February 04, 2018 @07:27PM
(#16305758)
Yes, thanks. Last I checked, you still lose features if you use manual memory management, betterC or no. Has this changed recently?
Re:RustBelt: securing the foundations of the Rust programmin...
by dawg on Sunday February 04, 2018 @11:28PM
(#16306595)
You loose builtin arrays and hashes and need to use a container library instead. Same goes for newing aggegates which can be replaced with smart pointers.
Escaping closures (delegates) no longer works, but you can explicitly capture context in a struct.
Those choices for builtin language features date back to the early inspiration from Java, but are increasingly being replaced with library implementations. We've added escape checking to the type system last year, and are currently working on safe aliasing (preventing use-after-free).
So yes, atm. when opting for @nogc you're somewhat at the frontier, and it's mostly a choice if you have time, hard requirements, or am very practised.
Avoiding most (but not all) GC allocations is already widely adopted in D's community though.
Re:RustBelt: securing the foundations of the Rust programmin...
by steveklabnik on Monday February 05, 2018 @11:02AM
(#16309591)
Thank you! I'm excited to see this stuff progress, but since I'm not involved with D anymore, it's hard to keep up at times :)