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
Rename ol.feature.FeatureStyleFunction to ol.FeatureStyleFunction #3602
Conversation
+1 |
1 similar comment
+1 |
What about removing completly the |
A |
Rename ol.feature.FeatureStyleFunction to ol.FeatureStyleFunction.
Since this PR breaks the stable API, it could have gone a bit further by
completly getting rid of `ol.feature.FeatureStyleFunction`.
I am wondering how an almost unused (according to your change note) method
is marked API stable while the useful one is experimental.
|
It does not break the stable API. The signature of the function is unchanged, it just moved to a different namespace, which is irrelevant for a typedef. |
The fully qualified name is changed, breaking all type casts to |
The upgrade notes say "If you compile your application together with the library and use the What is rare is not the use of a feature style function, it is the use of the
They're both useful. The fact that one is marked stable while the other is not is a mistake. |
The api stable Apart from the api discussion, there's absolutely no need for two typedefs: |
But the function signatures are different today, right? Are you suggesting that we should make them the same? |
I'm suggesting (and it was also @gberaudo's suggestion) to remove |
We're all clear that there are two things. One is the name of the type and the other is the signature/behavior of the functions. Regarding the name of the type In my opinion, the API is the JavaScript API. When something is marked as stable, we promise that a minor release will not make you change the way you write JavaScript. It is true that this change requires that people that compile their application together with the library need to change the comments in their code if they previously used This perspective focusses on people who write applications using a built version of the library. I understand if others want to extend the definition of our API to the types used when compiling an application together with the library. Regarding the function themselves If we want to completely remove layer.setStyle(function(feature, resolution) {
// function length is 2
// expects to be called with two args
});
feature.setStyle(function(resolution) {
// function length is 1
// expects to be called with `this` as the feature
}); I agree it would have been simpler to just have |
This puts
ol.FeatureStyleFunction
in the heap ofol
function typedefs (along withol.CanvasFunctionType
,ol.CoordinateFormatType
,ol.ImageLoadFunctionType
,ol.PreRenderFunction
,ol.TileLoadFunctionType
,ol.TileUrlFunctionType
,ol.TransformFunction
).This is really about avoiding problems with the API docs where a namespace matches a symbol in a case insensitive way (see #2149). But it also seems somewhat justified given the other
*Function
types.Fixes #2149.