So if people just return an ol.style.Style object, things will not work. Is there a way to make it work with both an ol.style.Style object as well as an array of ol.style.Style objects?
Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
There is a way to do this, but it will be bad for performance, causing regular de-optimisations.
Okay, is there any way to fallback to the default style? Or to output a warning or something that will point people in the right direction?
For a novice user it's a pretty common case to run into I guess.
If we want to support this, it can be done without any extra pressure on the garbage collector. I also don't see how this would lead to frequent deoptimization. If you're talking about optimization related to the styleFunction itself, I imagine the opportunity for maintaining the optimized version would be the same whether it was always returning an array or always returning a single style.
See my style branch for an example on how this could be supported.
Right @twpayne - that's consistent with my understanding. So deoptimization is only more likely if the style function sometimes returns an array and sometimes returns a style instance. I don't think this is what we're talking about here.