News for hackers. Stuff that matters.
Re:Two years of Rust by webkike on Monday May 15, 2017 @04:26PM (#14344821)
Consider how interfaces work and how you would have to implement them. Rust may have a more complicated type system and I suppose enums are more complicated in Rust, but the things I value as simple are more simple in Rust than Go.
Re:Two years of Rust by comex on Monday May 15, 2017 @05:05PM (#14345114)
What about interfaces? The basic idea of fat pointers with vtables works the same as Rust's trait objects. If you mean the ability to dynamically cast from one interface type to another, which Rust doesn't support - that does require a global list of implemented interfaces per type, but without generics that's not too hard to implement. (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)
Re:Two years of Rust by webkike on Monday May 15, 2017 @05:23PM (#14345250)
When ever you would need to box a trait object in Rust Go automatically performs a heap allocation that is garbaged collected at some point. A bit more is explained here https://research.swtch.com/interfaces Basically there are some property of Go interfaces that make them far more dynamic than traits and implementations in Rust.
Re:Two years of Rust by pcwalton on Monday May 15, 2017 @07:45PM (#14346217)
> (In Rust, it would be drastically more complex, verging on impossible to pull off with a good UX, due to various language features including wildcard impls, type-parameterized traits, and a Turing-complete type system.)

Swift can downcast, and it has generic extensions and generic protocols. I highly suspect it has a Turing-complete type system as well.

Supporting this requires heroic effort in the compiler, but it can be done.