March 22, 2016 Re: rust reaction to walter's talk on interfacing to C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Johan Engelen | On 3/22/2016 4:05 AM, Johan Engelen wrote:
> Shoot me down if unrelated and easily worked around: MSVC mangles "struct"
> differently from "class". Perhaps the D split between struct/class makes it hard
> to represent this MSVC mangling? (without changing the C++ source)
It is a current problem. I've thought of many solutions, but none were satisfying.
| |||
March 24, 2016 Re: rust reaction to walter's talk on interfacing to C++ | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Tuesday, 22 March 2016 at 11:00:44 UTC, Jonathan M Davis wrote: > That's funny. I would have said that those were _advantages_ for D. D's constness can certainly be unwieldy (some sort of equivalent to C++ mutable would be a very welcome addition if we could pull it off), but whatever flaws D's const may have, the transitivity is a huge plus overall IMHO, and I would have said that the struct/class split was a huge win. It properly segregates the inheritance stuff to reference types while not forcing all user-defined types of any complexity to be reference types. > > So, while I'm quite sure that Rust has advantages over D, I would not have listed those among them. > > - Jonathan M Davis Rust doesn't need D-style transitive const because it can be replicated using variable bindings and ownership. When you create an object and only assign it immutable binding for it it's transitively immutable forever. Tail mutability can be achieved by wrapping a field in std::Cell: https://doc.rust-lang.org/std/cell/ . Imo much less invasive than D's constness. Rust doesn't have implementation inheritance yet, so no class/struct split. We'll see how they deal with that, various proposals are made. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply