On Wed, Feb 05, 2003 at 03:03:24AM +0900, ts wrote:
> >>>>> "B" == Brian Candler <B.Candler / pobox.com> writes:
> 
> B> At very least, this will catch some typos in assignment statements, and it
> 
> >>>>> "M" == Mark Slagell <ms / iastate.edu> writes:
> 
> M> not its proper nouns. Please make the warnings optional so we can use 
> M> them that way.
> 
>  You don't think that it exist a problem when someone ask for warnings
>  and another person just want remove these same warnings.

I was asking for something different, and I'm sorry if I wasn't clear.

(1) Matz wants a compulsory warning here:

  foo = 0
  [1,2,3].each { |foo|         # << HERE
    ..
  }

Myself, and several others on this list, feel that this warning should be
optional. It's not really necessary at all, unless you're concerned about
making your scripts run on earlier versions of Ruby.

(2) I asked for a warning (optional, with -w) if a local variable is
assigned but not used. Examples would be:

  foob = 0            #  << HERE
  puts foo
  ... and no subsequent use of 'foob'

OR:

  foo = 1             #  << HERE
  if status = "OK"
    foo = 2
  end
  puts foob
  ... and no subsequent use of 'foo'

In both cases, a (method) local variable has been brought into play and
assigned to, but the value not used - either because the assignment was
misspelled, or all uses of it were misspelled.

This request can be considered entirely separately from the block-scoping
issue. It would incidentally catch a few perverse cases, for example

  i = 0
  ...
  [1,2,3].each { |i|
     i = 7            # << HERE, this value is never retrieved
  }

Regards,

Brian.