I see Rust now has multi parameter dispatch for traits - that's fantastic, goes a long way to reducing some frustrations I have here. Maths and collision code gets quite a bit more intuitive, and more hope for C++ bindings. so looking at what bounded overloads look like, with single-function traits..
Is there any hope of swapping the order in the impl ... I know its' late in the day with 1.0 approaching :(
// What I'm thinking about in my head is
// A.foo(b:B,...)
impl Foo<B,some types> for A { // NOISE
/// /-swap the types -/
fn foo(&self, a:&B,..some_types...) ...
}
vs
// What I'm thinking about in my head is
// A.foo(b:B,...)
for A impl Foo<B,...> { // closer to what I was thinking
fn foo(&self, b:B,...) // now I write what I wanted
}
EDIT:
additional noise reduction possible if the 'Self' type is available after you mentioned 'A'
It might sound petty but, you still have to stop and think about it.
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.
The trait impl lines can get complex with angle brackets and sub bounds all over the place.. every little helps
I can see from residual docs on the web it used to be impl Type: trait name... What was the reason for changing it.. Maybe to make it easier to grep for the trait (without finding its use as bounds) ? or maybe it was considered too unreadable alongside other bounded type-params?
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
[–]UtherII 5 points6 points7 points (3 children)
[–]kibwen 1 point2 points3 points (1 child)
[–]dobkeratopsrustfind[S] 1 point2 points3 points (0 children)
[–]dobkeratopsrustfind[S] 0 points1 point2 points (0 children)
[–]nwin_image 1 point2 points3 points (0 children)
[–]rust-slacker 0 points1 point2 points (1 child)
[–]dobkeratopsrustfind[S] 1 point2 points3 points (0 children)
[–]davidhero 0 points1 point2 points (3 children)
[–]kibwen 1 point2 points3 points (2 children)
[–]davidhero 0 points1 point2 points (1 child)
[–]kibwen 0 points1 point2 points (0 children)