Issue #796 has been updated by Tomas Matousek.


The error is reported e.g. in this case:

def foo
  C = 1
end

>> SyntaxError: (irb):2: dynamic constant assignment

but is not reported if eval is used. This works:

def foo
  eval('C = 1')
end

The restriction is IMO unnecesary and should be removed. If there is a good reason for keeping it it should be consistently applied in eval as well.

----------------------------------------
http://redmine.ruby-lang.org/issues/show/796

----------------------------------------
http://redmine.ruby-lang.org