From: "ko1 (Koichi Sasada)" Date: 2012-06-26T05:30:29+09:00 Subject: [ruby-core:45855] [ruby-trunk - Bug #5124][Feedback] foo = [*bar] implies foo.equal?(bar) Issue #5124 has been updated by ko1 (Koichi Sasada). Status changed from Assigned to Feedback nobu: ping. ---------------------------------------- Bug #5124: foo = [*bar] implies foo.equal?(bar) https://bugs.ruby-lang.org/issues/5124#change-27442 Author: adgar (Michael Edgar) Status: Feedback Priority: Normal Assignee: ko1 (Koichi Sasada) Category: core Target version: 1.9.3 ruby -v: - I just ran into this as a result of some slightly sloppy coding, but it did disagree with my internal assumptions. Normally, I expect the Array literal syntax to create a new object, every time. So when I rewrote some code and ended up with something similar to the following, my tests broke, and I'm not sure that's how it should be. Here's the reduced test case: some_ary = [1, 2, 3] bar = [*some_ary] bar << 4 p bar >> [1, 2, 3, 4] p some_ary >> [1, 2, 3, 4] I see it's clearly taking an opportunity for optimization, so I'm more than happy to hear that as a reason for rejecting this. It does warrant documentation somewhere, though, I'd say. Not sure where that documentation would go. -- http://bugs.ruby-lang.org/