Bound Items
Summary
Targets the bounding futures challenge.
This is a series of smaller changes (see detailed design), with the goal of allowing the end user to name the bound described in the challenge text in this way (i'll let the code speak for itself):
Detailed design
I'm not good at naming things, and all names and identifiers are subject to bikeshedding.
-
Bound Item(Language construct). Allow user to name a combination of bounds. No
Self
allowed here. Could replace thetrait_alias
language feature. Improve ergonomics of many existing code if used properly.I'm hesitant on which of
PascalCase
,snake_case
, orUPPER_CASE
should be used for this naming though. -
Syntax for refering to the type of a associated item in path. Currently using
fn
keyword. Can expand toconst
andtype
keywords if needed. Turbofish might be involved if the assoc item is generic. -
SimpleFnOnce
trait (Language item). A function can only accept one set of arguments, so all functions and closures shall implement this, while user-defined callable types doesn't have to. This is used for reasoning about the output parameters of associated functions. -
SimpleFnOnceWithSendOutput
trait (Lib construct or user-defined).
What's great about this
- Absolutely minimal type system changes.
- Quite easy to learn. (Name it and use the name)
- Easy to write library documentation, and give examples.
What's not so great
- New syntax item constructs. Three parsers (rustc, ra, syn) needs to change to support this.
- Very verbose code writing style. Many more lines of code.
- Will become part of library API in many cases.