Daniel Brockman ha scritto:
> gabriele renzi <surrender_it / remove-yahoo.it> writes:
> 
> 
>>I was'nt suggesting indentation based syntax, which I
>>dislike for reasons (i.e. commenting may mess syntax) that
>>do not apply to implict terminators.
> 
> 
> What do you mean, "commenting may mess syntax"?

well, if I write

def foozer(x):
  if x >10:
   print x
  do other stuff

and I do comment out the "if" line, there is a syntax error

> 
>>items.cool_method_name {|item| item*2 if item > 2}
>>
>>is quite doable in ruby
> 
> 
> Except you can't collect nil values that way.

Well, you can retain this same syntax for the common case and with 
various tricks (avoiding another method as argument) augment the method 
to handle "useful nils".
My favourite option is comparing the return value with a given 
parameter, defaulting to nil, so if you think you want to collect nils 
you can do:

items.filter_mapping(:skip) {|item| fobbar(item)? item : :skip}

Or you could throw something to skip collecting, and catch it in 
#cool_method. You could even write a "skip" method to throw stuff for you.