From: "Hal E. Fulton" Date: 2002-04-28T09:12:35+09:00 Subject: Re: $_ if no |var| ----- Original Message ----- From: "Lars Christensen" To: "ruby-talk ML" Sent: Saturday, April 27, 2002 4:16 PM Subject: Re: $_ if no |var| > On Sun, 28 Apr 2002, David Alan Black wrote: > > > I have to confess that to me it just doesn't look or feel like Ruby. > > I know that's very vague... that's why I was trying to come up with a > > case illustrating the importance (or at least Ruby-ness) of all the > > assignments being made, independent of any branching within the code > > of the block. > > I think you are right--I think I would 'expect' all assignments to be > made. I.e. > > proc { if |a| then |b| else |c| end } > > should only be syntatic sugar for > > proc { |a,b,c| if a then b else c end } > > or, equivalently > > proc { |p| a,b,c=p; if a then b else c end } > > The |a| would just be syntax to mark which symbols should be bound to the > arguments when the block is evaluated. > > I would also expect > > proc { if |a| then |b| else |c|+b end } > > to work, except in more complex cases, i'd use the current syntax. I agree with Lars, but I have misgivings about this construct in general. Would you allow: proc {|a| puts "b = #{|b|}"; do_something_with(c) } and that sort of thing? Sounds like a can of worms to me, a syntactic and semantic bad dream. Hal Fulton