ruby-core

Mailing list archive

[#71931] [Ruby trunk - Feature #11786] [Open] [PATCH] micro-optimize case dispatch even harder — normalperson@...

Issue #11786 has been reported by Eric Wong.

9 messages 2015/12/08

[ruby-core:72600] [Ruby trunk - Bug #11867] overriden constant instance variable mismatch

From: sephvelut@...
Date: 2015-12-29 19:33:54 UTC
List: ruby-core #72600
Issue #11867 has been updated by dingo egret.


Nobuyoshi Nakada wrote:
> Exactly.
> 
> What do you expect instead?

I expected the latest constant to set its @b property. If not Class A, at the very least I expected Struct :a to get set. Is this not the intuitive thing to expect? People send arguments based on param ordering in constant definition. This is totally bypassing that expectation.

----------------------------------------
Bug #11867: overriden constant instance variable mismatch
https://bugs.ruby-lang.org/issues/11867#change-55849

* Author: dingo egret
* Status: Feedback
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
~~~ruby
A = Struct.new(:a)

A.new(1)
#<struct A a=1>

class A
  def initialize(b)
    @b = b
  end
end

A.new(1)
#<struct A a=nil>
~~~

Is this expected?




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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next