I wrote a wiki page about impl Trait
, but I want to make sure that I use the right terminology. So I did some digging, and this is what I found out:
-
The first RFC allows
impl Trait
only in return position, so it calls it an abstract return type. -
The second RFC, which expands
impl Trait
syntax to function arguments, just refers to it as "impl Trait
". The book does the same.I don't particularly like this name, because it describes the syntax but not the purpose of the feature. Furthermore, to incorporate it in an English sentence, you have to resort to phrases like "the
impl Trait
syntax" or "theimpl Trait
feature". -
The compiler calls it an opaque type (see playground), as does the Guide to Rustc Development.
Therefore I'm inclined to use the name "opaque type". The problem is that "opaque" is an overloaded term: Extern types are also called opaque, and even structs that don't expose implementation details are sometimes called opaque, e.g. here and here.
I'd like to have a name for this that is both descriptive and unambiguous, and is used by all the official documentation as well as the compiler. I believe that such a name doesn't exist (yet). I'd like to hear your opinions, if you agree that this is a problem, and how it could be addressed!