"Function pointers" should not be named as such


Currently in Rust, there are two kinds of types that represent functions:

  1. Function item types: the types of function items, fn(arg_list) -> ret_type {foo}s (fn{f}s below).
  2. Function pointer types: the types of pointers to functions, fn(arg_list) -> ret_types (fns below).

They are both pointer-like (and are actually implemented with pointers under the hood), but not actually considered pointers by the language. So it is technically incorrect to call fns “function pointer types”, and fn{f}s may also need a name more specific than simply “function item types”.

The fact that Rust currently doesn’t have true function pointers means other problems, but let’s leave this to other discussions, and just say that the name “function pointer” should be reserved for something that are actually considered pointers.

So, I propose that following terminology changes:

  1. Use “static function handle types” as a synonym for “function item types”
  2. Rename “function pointer types” to “dynamic function handle types”.
  3. The two families of types are collectively known as “function handle types”.

All messages in rustc and the documentations should be updated accordingly.

What do you think?