From: Hal Fulton Date: 2003-11-29T04:21:21+09:00 Subject: Re: Controlled block variables T. Onoma wrote: > On Friday 28 November 2003 12:08 pm, Gavin Sinclair wrote: > >>We can forget about methods, etc. What we're talking about comes down >>to this: should this syntax work? >> >> p = proc { |x| x + 1 } >> n = p(5) # => 6 >> >>That has been discussed on the list before. I'm not au fait with all >>the whys and wherefores, but the proposition has never excited me, nor >>has it gathered significant support. > > > Sure, I understand. I'm just wonder if it can be done. Hence my original > question. Or whether there is some impossible barrier. That's all. One thing that comes to my mind is this: The () notation seems to make sense for a variable that happens to refer to a proc. But what if you stick parens on a variable that isn't a proc? This seems like a syntax error, but it would have to be detected at runtime. foo = proc {...} 1.upto(5) do |i| foo = "Haha!!" if i==4 foo() # What happens when i is 4? end Hal