The word/type they wanted for this was the Unit type: https://en.wikipedia.org/wiki/Unit_type and in that list it even states the `std:monotype` is a Unit.
The word/type they wanted for this was the Unit type: https://en.wikipedia.org/wiki/Unit_type and in that list it even states the `std:monotype` is a Unit.
Like, if we assume someone looking at code with `std::unit`, what might they think this is? If one is not aware of its use in ML or similar, it could just as easily be assumed that it could be something to do with units like meters or kilograms or whatnot. After all, the C++ standard library is vast so it wouldn't necessarily be all that far-fetched.
Then the only question would be to ask why it would be default-constructible. At which point you'd have to read the docs for the type anyway.
And if my grandmother had wheels she'd be a bicycle. Of course if there wasn't a standard name for this concept that had been used in the industry for 50+ years (and in theoretical work for over 100) then it wouldn't make any difference what name you used for it. But given that there is a standard name for this concept that has been used in the industry for 50+ years, making up a different name is pretty unfortunate.
But to their dismay the crazier it gets, the more some people dig in and embrace it even more.
/sarcasm. I think.
It's common enough that articles have been written against this usage: https://web.archive.org/web/20170224220253/http://jackieokay...
So this usage of functor may never have been "official", but it's widespread in the community.
† I don't know if the original mistake was his, but he certainly did a lot to spread it.
https://en.cppreference.com/w/cpp/experimental/reflect
https://en.cppreference.com/w/cpp/utility/variant/visit2
https://en.cppreference.com/w/cpp/experimental/parallelism
Visual Studio's official documentation uses the term functor as of 2021:
https://learn.microsoft.com/en-us/cpp/standard-library/funct...
A simple Google search shows no shortage of recent websites and documents including fairly authoritative references using the term functor to describe a type that overloads operator ().
Heck even the author of this article, Raymond Chen, uses the term functor as recently as 2020 to describe such a construct:
https://devblogs.microsoft.com/oldnewthing/20200513-00/?p=10...
Is Raymond Chen not a C++ expert?
The word "functor" has a long and glorious history in C++. Try entering "C++ Andrei Alexandrescu functors" into your internet search engine of choice. For bonus points, try "c++ Scott Meyers functor" as well.
The C++ usage was introduced by Jim Coplien in his 1992 book as a succinct name for an architectural pattern in C++: https://archive.org/details/advancedcbsprogr00copl/page/166/...
https://stackoverflow.com/questions/54336641/is-there-any-re...
Before C++ popularized the term, other programming languages and libraries had already used "vector" to describe similar data structures. For example, Common Lisp has a vector type that represents a one-dimensional array.
Interview with him acknowledging this:
And computing has interrupt vectors as well.