About ReToDoRule

MD
Marcus Denker
Mon, May 9, 2022 1:12 PM

I have never seen ReToDoRule to suggest a change that I wanted to do.

I think it tries to detect if there is #at: send to the collection inside the block and suggests to use more high-level iterators.

But the suggestions are odd and it seems to be too naive with just detecting the #at: message send to the iterated value.

"Checks for use of to:do: when a do:, with:do: or timesRepeat: when should be used.”

• #timesRepeat: does not take an argument for the block with the running index, so it is not a replacement
• with:do: is not a replacement for to:do: ? it would mean creating first a collection and then iterating
• using do: on an interval is bad, we even have a rule against that: ReUnoptimizedToDoRule

Maybe I am missing something?

The rule ReToDoCollectRule seems to be working nicely, though.

Issue tracker entry: https://github.com/pharo-project/pharo/issues/11162

I have never seen ReToDoRule to suggest a change that I wanted to do. I think it tries to detect if there is #at: send to the collection inside the block and suggests to use more high-level iterators. But the suggestions are odd and it seems to be too naive with just detecting the #at: message send to the iterated value. "Checks for use of to:do: when a do:, with:do: or timesRepeat: when should be used.” • #timesRepeat: does not take an argument for the block with the running index, so it is not a replacement • with:do: is not a replacement for to:do: ? it would mean creating first a collection and then iterating • using do: on an interval is bad, we even have a rule against that: ReUnoptimizedToDoRule Maybe I am missing something? The rule ReToDoCollectRule seems to be working nicely, though. Issue tracker entry: https://github.com/pharo-project/pharo/issues/11162
MD
Marcus Denker
Tue, May 10, 2022 6:36 AM

Nobody seems to have an immediate reason that it is good to keep, I propose to just remove that rule:

https://github.com/pharo-project/pharo/pull/11164 <https://github.com/pharo-project/pharo/pull/11164>

(PR in need of a review!)

On 9 May 2022, at 15:12, Marcus Denker marcus.denker@inria.fr wrote:

I have never seen ReToDoRule to suggest a change that I wanted to do.

I think it tries to detect if there is #at: send to the collection inside the block and suggests to use more high-level iterators.

But the suggestions are odd and it seems to be too naive with just detecting the #at: message send to the iterated value.

"Checks for use of to:do: when a do:, with:do: or timesRepeat: when should be used.”

• #timesRepeat: does not take an argument for the block with the running index, so it is not a replacement
• with:do: is not a replacement for to:do: ? it would mean creating first a collection and then iterating
• using do: on an interval is bad, we even have a rule against that: ReUnoptimizedToDoRule

Maybe I am missing something?

The rule ReToDoCollectRule seems to be working nicely, though.

Issue tracker entry: https://github.com/pharo-project/pharo/issues/11162

Nobody seems to have an immediate reason that it is good to keep, I propose to just remove that rule: https://github.com/pharo-project/pharo/pull/11164 <https://github.com/pharo-project/pharo/pull/11164> (PR in need of a review!) > On 9 May 2022, at 15:12, Marcus Denker <marcus.denker@inria.fr> wrote: > > I have never seen ReToDoRule to suggest a change that I wanted to do. > > I think it tries to detect if there is #at: send to the collection inside the block and suggests to use more high-level iterators. > > But the suggestions are odd and it seems to be too naive with just detecting the #at: message send to the iterated value. > > "Checks for use of to:do: when a do:, with:do: or timesRepeat: when should be used.” > > • #timesRepeat: does not take an argument for the block with the running index, so it is not a replacement > • with:do: is not a replacement for to:do: ? it would mean creating first a collection and then iterating > • using do: on an interval is bad, we even have a rule against that: ReUnoptimizedToDoRule > > > Maybe I am missing something? > > > The rule ReToDoCollectRule seems to be working nicely, though. > > Issue tracker entry: https://github.com/pharo-project/pharo/issues/11162 > > >