Hacker News new | ask | show | jobs
by jenadine 1034 days ago
> TAITs

I personally find these 4 letter acronyms difficult to lookup and understand. One of the T is probably "trait", but I always forget.

1 comments

Sorry, the names we use within the team are not meant to be used in user facing communications, but it is easy to forget that not everyone I talk to isn't in the team :)

TAIT stands for `type Alias = impl Trait;`, which would let you do something like

    type Alias = impl Display;
    fn foo() -> Alias {
        42
    }
    fn bar() -> Alias {
        0
    }
    fn main() {
        let x: Alias = if rand() > .5 {
            foo()
        } else {
            bar()
        };
    }
If you changed bar to return a &str, for example, that would be a compile error.

There's also the related

- RPIT, "return position impl trait" (we already have this)

- RPITIT, "return position impl trait in traits" (the foundation for async unctions in traits, `trait T { fn foo() -> impl Trait; }`)

- AFIT, "async functions in traits"

No, you shouldn't need to know what these things mean, beyond them "just working" in terms of what you would expect from writing impl Trait in different places.