ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:80253] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
@ 2017-03-20 18:36 ` faraz.yashar
  2017-05-19  6:52 ` [ruby-core:81253] " ko1
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: faraz.yashar @ 2017-03-20 18:36 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been reported by faraz (Faraz Yashar).

----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337

* Author: faraz (Faraz Yashar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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. 



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:81253] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
  2017-03-20 18:36 ` [ruby-core:80253] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables faraz.yashar
@ 2017-05-19  6:52 ` ko1
  2019-06-24 21:05 ` [ruby-core:93342] " merch-redmine
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: ko1 @ 2017-05-19  6:52 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by ko1 (Koichi Sasada).


This is specification.

(1) parse `example` method and define `foo`.
(2) In `eval` method, compile given string (`"foo"`) and defined `foo` was used (without any problem).

So it is documentation issue.
Can anyone write about it?


----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-64914

* Author: faraz (Faraz Yashar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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. 



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:93342] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
  2017-03-20 18:36 ` [ruby-core:80253] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables faraz.yashar
  2017-05-19  6:52 ` [ruby-core:81253] " ko1
@ 2019-06-24 21:05 ` merch-redmine
  2019-06-24 21:11 ` [ruby-core:93344] " chris
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: merch-redmine @ 2019-06-24 21:05 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by jeremyevans0 (Jeremy Evans).

File doc-eval-local-var.patch added

ko1 (Koichi Sasada) wrote:
> This is specification.
> 
> (1) parse `example` method and define `foo`.
> (2) In `eval` method, compile given string (`"foo"`) and defined `foo` was used (without any problem).
> 
> So it is documentation issue.
> Can anyone write about it?

Attached is a documentation patch.  However, a committer with more knowledge of the internals should probably check to see if it is technically accurate.

----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-78847

* Author: faraz (Faraz Yashar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:93344] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-06-24 21:05 ` [ruby-core:93342] " merch-redmine
@ 2019-06-24 21:11 ` chris
  2019-06-25  7:20 ` [ruby-core:93355] " nobu
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: chris @ 2019-06-24 21:11 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by chrisseaton (Chris Seaton).


This is as specified here

https://github.com/ruby/spec/blob/db74bf3313b4d49650417ba91b4e2d67cc253dc5/core/kernel/eval_spec.rb#L31-L68

----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-78849

* Author: faraz (Faraz Yashar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:93355] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2019-06-24 21:11 ` [ruby-core:93344] " chris
@ 2019-06-25  7:20 ` nobu
  2019-06-25 17:43 ` [ruby-core:93362] " nobu
  2019-06-25 17:59 ` [ruby-core:93363] " merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2019-06-25  7:20 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by nobu (Nobuyoshi Nakada).


jeremyevans0 (Jeremy Evans) wrote:
> Attached is a documentation patch. 

Seems fine.

A question:
> However, local variables set inside the call to +eval+ will not be reflected in the surrounding scope.

Isn't "set" vague a little, between "defined" an "assigned"?



----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-78865

* Author: faraz (Faraz Yashar)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:93362] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2019-06-25  7:20 ` [ruby-core:93355] " nobu
@ 2019-06-25 17:43 ` nobu
  2019-06-25 17:59 ` [ruby-core:93363] " merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: nobu @ 2019-06-25 17:43 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by nobu (Nobuyoshi Nakada).


"local variables assigned inside the call to +eval+" sounds like a just assignment to a local variable defined outside, doesn't it?

----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-78877

* Author: faraz (Faraz Yashar)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ruby-core:93363] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables
       [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
                   ` (5 preceding siblings ...)
  2019-06-25 17:43 ` [ruby-core:93362] " nobu
@ 2019-06-25 17:59 ` merch-redmine
  6 siblings, 0 replies; 7+ messages in thread
From: merch-redmine @ 2019-06-25 17:59 UTC (permalink / raw
  To: ruby-core

Issue #13337 has been updated by jeremyevans0 (Jeremy Evans).


nobu (Nobuyoshi Nakada) wrote:
> "local variables assigned inside the call to +eval+" sounds like a just assignment to a local variable defined outside, doesn't it?

It could definitely be interpreted that way.  I'll reword it to make it more clear. Thanks!

----------------------------------------
Bug #13337: Eval and Later Defined Local Variables
https://bugs.ruby-lang.org/issues/13337#change-78878

* Author: faraz (Faraz Yashar)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.0
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I've noticed the following behavior with eval:

~~~ ruby
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)


-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-25 17:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-13337.20170320183620@ruby-lang.org>
2017-03-20 18:36 ` [ruby-core:80253] [Ruby trunk Bug#13337] Eval and Later Defined Local Variables faraz.yashar
2017-05-19  6:52 ` [ruby-core:81253] " ko1
2019-06-24 21:05 ` [ruby-core:93342] " merch-redmine
2019-06-24 21:11 ` [ruby-core:93344] " chris
2019-06-25  7:20 ` [ruby-core:93355] " nobu
2019-06-25 17:43 ` [ruby-core:93362] " nobu
2019-06-25 17:59 ` [ruby-core:93363] " merch-redmine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).