Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.1.6
-
Fix Version/s: None
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
Description
In 1.8 mode, evals at the same lexical scoping level should share the same "eval scope". (in 1.9 all evals get their own scopes) But in JRuby, instance_eval and module_eval/class_eval do not share scopes. This leads to a couple rubyspec failures (specs added by me):
1) Kernel#instance_eval shares a scope across sibling evals FAILED Expected to not get Exception core/kernel/instance_eval_spec.rb:36 1) Module#module_eval shares a scope across sibling evals FAILED Expected to not get Exception core/module/shared/class_eval.rb:10
The reason we fail this is somewhat complicated. In order to support instance_eval having a separate "cref" class (the containing scope for constant definition, etc), we always create a new scope for it. So with current scoping structures there's no way to both share variables and have a different cref. For the moment, the variable-sharing is the lesser problem (since cref can't be allowed to break) so that's how I'm leaving it for now. But we'll need to fix the scoping at some point.
This is a 1.8-specific issue that is covered by specs and tags. Resolving as incomplete; it will go away, and we don't keep RubySpec issues anymore.