Syntax consistency of Particle.subscribe and function

Seems some of them use const char * as arguments (subscribe) for the callback type, and others take String (function). Would be nice if those were consistent.

And did you mean this to be String, or String & ?

I’d prefer const char * in the unrealistic case anybody wanted to know.

Thanks for the feedback. Can you detail exactly what function definitions are you interested in? It would be nice to have a clear understanding of what you want.

I just want consistency. If you have two places where a callback function can be given, and one of those is expected to take String, and the other const char *, that’s not good because I have to implement a converter (as I had to do today). Pick one style, and apply it consistently.

My personal view is that it should be const char *, not String, as the reasons why you created the String class do not apply here.

2 Likes

Updated the post title to make it clear that the post is about syntax, not about performance!

Got it. Thanks for clarifying. Feel free to post an issue to the firmware repo or even submit a PR with a fix