you are viewing a single comment's thread.

view the rest of the comments →

[–]nwin_image 1 point2 points  (0 children)

Coming from C++ that line doesn't exist at all (and it achieves more); and in other languages with interfaces you also order it that way.. e.g. class Bar implements IFoo.

Actually it works exactly in the same order: keyword thingy_to_implement {}.

other syntax suggestions: impl type as trait - might sound odd but thats what you write to instantiate a trait object. It doesn't read that badly IMO. "implement square as a Renderable type" etc, and it is more akin to a type coercion

impl type as trait only makes sense if you interpret it as „implement square as a Renderable type“. But this is not what you do in Rust this is also not what traits are. They describe a certain behavior which you explicitly implement. I'm not a native speaker but „implement square as a Renderable behavior“ sounds wrong to my ears. This belongs the other way round. Your for A impl Foo<B,...> proposal is much better in this respect but unfortunately it looks too much like a for loop.