> On 6/11/09, James French <James.French / naturalmotion.com> wrote:
>> Hi,
>>
>> In ruby 1.8.7 this does not work (syntax error):
>>
>> class A
>>
>> def test=(val, &block)
>> end
>>
>> end
>>
>> A.new.test = 10 do
>> end
>>
>>
>> I would really like to an associate a block in this way. Is there a way
>> round this?
I'm pretty sure this is not a bug. It's been discussed once or twice
before on the ruby-talk list.
What are you trying to do with this syntax? Note the potential for
ambiguity:
A.new.test = [1,2,3].find do |i| i>1 end
This is currently parsed as
A.new.test = (
[1,2,3].find do |i| i>1 end
)
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407