Hi everyone,

I would like to know why the following code does not work :
-----
class A

  def A.[](*args,&block)
    result = self.new( *args )
    if block
      yield result
      result.end
    end
    return result
  end

  def end()
    puts "end"
  end

end

A[] do |a|
  puts "a #{a.inspect}"
end
-----

When I want to execute this script, the interpreter outputs the
following error :
--
d:/DEV/XRVG/bug.rb:18: parse error, unexpected kDO, expecting $
A[] do |a|
--

If I write "A.[] do |a|" instead of "A[] do |a|", it is OK and
outputs:
----
a #<A:0x28ee264>
end
----

Any idea ?
Any help appreciated !! Thanks in advance.