rust-lang / keyword-generics-initiative

Public repository for the Rust keyword generics initiative
https://rust-lang.github.io/keyword-generics-initiative/
Other
96 stars 11 forks source link

Add draft RFC for effect-generic types #61

Open yoshuawuyts opened 3 months ago

yoshuawuyts commented 3 months ago

Adds a draft RFC for effect-generic types. This is the third in the series, and builds on the previous drafts for effect-generic trait declarations, and effect-generic bounds and functions.

The desugaring portion of this RFC on filing will be out of date. This still uses the older const-bool approach, which has since been replaced with the more potent const-enum approach in the compiler. We need to redraft the desugaring portions of all RFCs to make use of this new system, but we probably want to wait until Oli is back from PTO to do that. Even still tho: the desugaring in this RFC should still be sound, even if not ideal.

Thanks!

clarfonthey commented 3 months ago

One small nit, but I don't think we should use the cfg attribute for omitting fields here, since it would be a rather unprecedented way to use it-- it implies cfg(effect = effect) is just a flag that can be checked throughout the program which is not the case. Perhaps a when(effect = effect) and unless(effect = effect) might be better.

yoshuawuyts commented 3 months ago

Okay, yeah for sure we can change that to something different. You raise a good point that cfg already means: "compile time evaluated" and so it makes sense not to change that meaning.

when as a bound seems nice enough; happy to go with that in the draft. Thank you for raising this!