-
Notifications
You must be signed in to change notification settings - Fork 13.3k
#6583 is breaking change - developers should know. #8046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@earlephilhower, Is it possible to notify other library developers of such significant changes in advance? |
@Hieromon while it does look like this escaped notice as a breaking change, it was in the development repo for almost a full year before the 3.0.0 release, which is really the only way we have of letting the world know where the repo is going. @mathertel we can add a note on the next bugfix about this, sure. Because this is a 2.x -> 3.x transition, breaking changes are expected, but looks like we missed a note about this. |
Thanks. |
Here is a code snipped to declare the function so they can be implemented using the same code:
Same for |
I reluctantly adopted the following implementation to ensure backward compatibility with my library. It's an incomplete method that relies on fixed member function signatures and is verbose if I try to write it completely. template<typename T>
struct TypeOfArgument;
template<typename T, typename U, typename... V>
struct TypeOfArgument<U(T::*)(V...)> {
template<size_t i>
struct arg {
typedef typename std::tuple_element<i, std::tuple<V...>>::type type;
};
};
// Determines the type of the uri argument contained in the member function
// signature of the RequestHandler class. This redefinition procedure ensures
// backward compatibility with ESP8266 arduino core 3.0.0 and later.
// However, it relies solely on the canHandle member function as a criterion
// and lacks completeness.
using URI_TYPE_SIGNATURE = std::conditional<
std::is_lvalue_reference<TypeOfArgument<decltype(&RequestHandler::canHandle)>::arg<1>::type>::value,
const String&,
String
>::type;
Class Foo : RequestHandler {
public :
Foo(){}
~Foo(){}
bool canHandle(HTTPMethod requestMethod, URI_TYPE_SIGNATURE requestUri) override;
bool canUpload(URI_TYPE_SIGNATURE uri) override;
bool handle(WebServerClass& server, HTTPMethod requestMethod, URI_TYPE_SIGNATURE requestUri) override;
void upload(WebServerClass& server, URI_TYPE_SIGNATURE requestUri, HTTPUpload& upload) override;
}; Initially, I tried to use esp8266::coreVersionNumeric, which is the recommended method for absorbing version, but |
Would a global define restoring the old-and-esp32-compatible API help ? |
Closing this issue per following actions
|
@d-a-v In conclusion, I find it difficult to completely eliminate the legacy method of relying on #define to satisfy static type determination in C++11 as a way to keep backward compatibility. It detains us. |
Basic Infos
The topic
There was a change should be listed under breaking changes as you have to re-write the parameter on any handler overriding the existing functions. If you have no override annotation it even does compile - but do not work.
Was introduced in #6583
As there is no example where a class is deriving from RequestHandler this is not detected in builds.
The text was updated successfully, but these errors were encountered: