I think we should be consistent and allow them everywhere or nowhere.


Niko

March 21, 2013 4:52 PM



Yes, I neglected to include the defn of lifetimes.

It looks to me like the current compiler allows trailing commas after lifetimes, but not after type parameters (sigh). I'm assuming that's not the best solution. What should it be?

John


March 21, 2013 4:12 PM
That looks about right, though

(1) as we said on IRC `&static` ought to be changed to `'static` (or, eventually, any lifetime name).
(2) I presume lifetimes = lifetime | lifetime, lifetimes
(3) we typically allow trailing commas, and we probably do here as well (or at least probably should?).


Niko

March 21, 2013 3:07 PM
I'm just fixing a few bugs, and trying to make sure I understand the grammar of generics. Here's what I've got. Can someone correct me, if I'm wrong? I've lifted comments from a couple of functions, so you can ignore the words "matches" and "where". Also, the definition of 'ty' is not provided :). I'm assuming a hopefully-obvious BNF syntax.

John



// matches generics = ( ) | ( < > ) | ( < typaramseq > ) | ( < lifetimes > ) | ( < lifetimes , typaramseq > )
// where typaramseq = ( typaram ) | ( typaram , typaramseq )

// matches typaram = IDENT optbounds

// matches optbounds = ( ( : ( boundseq )? )? )
// where boundseq = ( bound + boundseq ) | ( bound )
// and bound = ( & STATIC ) | ( ty )

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to