If you are doing bug fixes in the juce6 branch, is there any way we can currently legally use this since there is no way to buy a juce6 license yet? Am I allowed to cherry pick this into my develop branch?
Looking at this fix, it seems it’s using the Colour constructor to build the HSL object. But Juce doesn’t use HSL. It’s using HSB which is different. On the surface, it might seem the same because in the English language brightness and lightness might be semi-interchangeable, but the concepts are slightly different.
Small OT: I’ve noticed that the commits related to HSL also drop some const qualifiers in the float arguments to various methods of Colour. What’s the rationale behind that, given the fact that those values aren’t changed in the method body?
Uhm… when it’s in the declaration, I’d agree with you that it doesn’t matter.
But in the definition of the method, where const can be present regardless of whether it’s there in the declaration, I think it has a useful purpose: to prevent the body of the method from inadvertently changing a value that’s not meant to.
It’s exactly the same rationale behind the declaration of const local variables.
If you have a local variable or function parameter which is not going to be changed then you should consider making it const. But the factors to consider here are that adding const makes the code more verbose, and that may add unnecessary visual clutter if the constness is unimportant or obvious. Or it could be a positive thing if it’s useful for the reader’s attention to be drawn to the fact that this variable is constant. A general rule is that in very short block of code, don’t worry about making local variables const. In longer blocks where a variable is used many times, you may want to make it const if you think it’s a helpful tip to the reader. Note that In almost all cases declaring a primitive value as const makes no difference whatsoever to the compiler’s code generation.
I’d argue that in these cases, the constness of the function parameters is unimportant and the code is short enough that it’s unnecessary - it just ends up being visual clutter when you’re scanning the code.