Project

General

Profile

Actions

Bug #13337

closed

Eval and Later Defined Local Variables

Added by faraz (Faraz Yashar) about 7 years ago. Updated almost 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:80253]

Description

I've noticed the following behavior with eval:

def example
  eval("foo") # => nil, but would expect a NameError
  eval("bar") # => NameError
  foo = 1
end

I'm assuming this behavior is expected, since "eval" executes in the context of the existing YARV instructions and local table, but I'm not certain since I haven't seen this behavior documented anywhere.


Files

doc-eval-local-var.patch (1.63 KB) doc-eval-local-var.patch jeremyevans0 (Jeremy Evans), 06/24/2019 08:56 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0