"Ian Bartholomew" <
[hidden email]> wrote in message
news:
[hidden email]...
> If you have the following code in a method then the compiler warns that
> #arg
> is assigned but is not used. The CodeMentor does not detect any problems.
>
> 1 ifNil: [self test] ifNotNil: [:arg | self test]
>
> I tend to agree with the CodeMentor in this case.
>
This is by design. There is an assignment to the ifNotNil block's 'arg'
argument, the one which is generated to set the value of the argument. In
this case the compiler is effectively warning you that you should use the
niladic form, i.e.
1 ifNil: [self test] ifNotNil: [self test]
Regards
Blair