Hi Julien,
You are right, Float intervals are not to be encouraged!
But if a knowledgeable person wants to use it, why forbid it?
Why not forbid Float alltogether then?
In the same vein, I saw C compiler warning me about using Float = (== in C).
Great! Now I cannot use -Wall -Werror, though I perfectly know where I can use == and where I cannot...
I understand the intentions, but in french, don't we say that hell is paved with good intentions?
Warning about = and not warning about < <= > >= != is kind of stupid common knowledge not very well assimilated...
Like telling me that I should use a tolerance (a-b) abs < eps, as kind of miraculous workaround. Err...
The problem is now to choose eps and deal with false positive/negative, and bad news, there's no such thing as a universal eps.
So in this spirit, I would restrain from forbiding anything.
Rather, you could add a rule checking for that construct for the purpose of educating.
And please, if activating the rule on some continuous integration Cerberus bot, then provide a way to explicitely bypass it in exceptional conditions!
Last thing, Interval enumeration is not performed via cumulative additions
���� start + step + step + step + ....
But rather with a multiplication which performs well better wrt loss of accuracy:
�� start + (index - 1 * step)
See Interval>>do:
Unfortunately, #to:do: #to:by:do: and their inlined versions do not follow this pattern, but use cumulative additions
(at least in Squeak, to be confirmed in Pharo...)
If I would change something, that would be that.
Remember, "You can cheat as long as you don't get caught", I think I caught the inliner with this snippet:
Beware, most loops are for Integer and should not be de-optimized too much (cheating can be a tough problem)...