3 ms·
> D slices are fat pointers as well: So are Rust's. Possibly more interestingly, so are its trait objects, the trait object pointer is a (vtable, instance) ra
by masklinn 7y ago
> D slices are fat pointers as well:
So are Rust's.
Possibly more interestingly, so are its trait objects, the trait object pointer is a (vtable, instance) rather than (instance*, length).
Also of note: that applies to "owned pointers" (`Box`) not just "references", despite the former looking very struct-like: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a0d4e151acba3b8f273666946613f789 https://play.rust-lang.org/?version=stable&mode=debug&editio...
In a way, C++ and Rust (and possibly D?) have pretty much an infinity of fat pointers as anything can be made to deref' to something else, and be more than one pointer wide (e.g. C++'s std::string and std::vector and Rust's String and Vec)
- ainar-g 7y ago> Possibly more interestingly, so are its trait objects, the trait object pointer is a (vtable, > instance) rather than (instance*, length). The Go interfaces are the same. See https://research.swtch.com/interfaces https://research.swtch.com/interfaces.