Two new critique rules: RBRuleIfNotEmptyDo and RBRuleIfNotNilDo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Two new critique rules: RBRuleIfNotEmptyDo and RBRuleIfNotNilDo

Marcus Denker-4
Hi,

I added two rules:

RBRuleIfNotNilDo
RBRuleIfNotEmptyDo

They are finding the uses of

ifNotEmptyDo:
ifNotEmptyDo: notEmptyBlock ifEmpty: emptyBlock
ifEmpty: emptyBlock ifNotEmptyDo: notEmptyBlock
ifNotNilDo: aBlock
ifNotNilDo: ifNotNilBlock ifNil: nilBlock
ifNil: nilBlock ifNotNilDo: ifNotNilBlock

In all these cases you can just use the normal version without do:

In the past there was even yet another one: doIfNot… we thankfully deprecated
and removed that in the past.

We kept the Do: variants for compatibility, but the problem is that people nevertheless
use them. All users now were added after we already rewrote once all users…

With the code critique, I hope this will stop.

(yes, not gravely important… but things like that have an impact if you do lots of them)

        Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Two new critique rules: RBRuleIfNotEmptyDo and RBRuleIfNotNilDo

Sean P. DeNigris
Administrator
Marcus Denker-4 wrote
We kept the Do: variants for compatibility, but the problem is that people nevertheless
use them
This seems inevitable with things that are loaded by default. Can we extract the compatibility methods into a Grease-like library that can be loaded only when needed?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Two new critique rules: RBRuleIfNotEmptyDo and RBRuleIfNotNilDo

Marcus Denker-4

> On 17 Aug 2015, at 13:23, Sean P. DeNigris <[hidden email]> wrote:
>
> Marcus Denker-4 wrote
>> We kept the Do: variants for compatibility, but the problem is that people
>> nevertheless
>> use them
>
> This seems inevitable with things that are loaded by default. Can we extract
> the compatibility methods into a Grease-like library that can be loaded only
> when needed?

Yes, that would be nice.

        Marcus
Reply | Threaded
Open this post in threaded view
|

Re: Two new critique rules: RBRuleIfNotEmptyDo and RBRuleIfNotNilDo

stepharo
In reply to this post by Marcus Denker-4
marcus
having rules is the best way to go and potentially create a compatiblity
package if necessary.
I like rules because they help freeing my mind

Stef

Le 17/8/15 11:28, Marcus Denker a écrit :

> Hi,
>
> I added two rules:
>
> RBRuleIfNotNilDo
> RBRuleIfNotEmptyDo
>
> They are finding the uses of
>
> ifNotEmptyDo:
> ifNotEmptyDo: notEmptyBlock ifEmpty: emptyBlock
> ifEmpty: emptyBlock ifNotEmptyDo: notEmptyBlock
> ifNotNilDo: aBlock
> ifNotNilDo: ifNotNilBlock ifNil: nilBlock
> ifNil: nilBlock ifNotNilDo: ifNotNilBlock
>
> In all these cases you can just use the normal version without do:
>
> In the past there was even yet another one: doIfNot… we thankfully deprecated
> and removed that in the past.
>
> We kept the Do: variants for compatibility, but the problem is that people nevertheless
> use them. All users now were added after we already rewrote once all users…
>
> With the code critique, I hope this will stop.
>
> (yes, not gravely important… but things like that have an impact if you do lots of them)
>
> Marcus
>