I agree that having the assignment case work would be great,
but there is still the problem of the programmer having to
come up with names. If there's anything Rails has taught us,
it's that there is power in convention. I think having the
'it' variable be *the* ruby implicit default name would be
powerful if taken to it's logical limits. It's like a safe,
less hacky version of $_ from perl that reads nicer too.
Think of how many times you come up with a meaningless name
to pass to a block. These meaningless names serve to confuse
your readers if they are not required to disambiguate nested
blocks, etc. In this case:
return a if (a = v+1) > 10
the name 'a' is really a waste, if you can leverage the power
of convention to use 'it'.
As I've thought more about this, I am quite happy with the
'let' implementation which just yields it's values forward.
This gets me all the semantics I want, but its just a bit
cumbersome to write and I still have to come up with those
damn meaningless names so ruby has something to bind with.
This is the last pain point:
You say foo, I say bar, bob says boo, and chuck says baz,
so depending on *who* writes it, we end up with:
with (v+1) { |foo| return foo if foo < 10 }
with (v+1) { |bar| return bar if bar < 10 }
with (v+1) { |boo| return boo if boo < 10 }
with (v+1) { |baz| return baz if baz < 10 }
When you've got 12 programmers, this disconnect gets hairy.
By adding the "'it' is default name" rule, *everyone* who
knows their Ruby will write:
with (v+1) { return it if it < 10 }
by adding the 'bars around expression get transformed into
call to 'with' rule on top of that (debatable since the
semantics are a bit sloppy):
return it if |v+1| < 1
Personally, the 'default name is 'it'' rule seems incredibly
useful, the bars are nice too but I don't have my heart
set on them.