Issue #12716 has been updated by Sameer Deshmukh.


Nobuyoshi Nakada wrote:
> Arguments consume the system stack.

Why not modify the function slightly such that it can also accept an Array containing index numbers as an argument? That way there won't be a need to specify so many arguments.

----------------------------------------
Bug #12716: Array#values_at fails for large argument size
https://bugs.ruby-lang.org/issues/12716#change-60340

* Author: Sameer Deshmukh
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [i686-linux]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Say I have this Array:

~~~ ruby
a = [1] * 140_000
~~~

Now, I call Array#values_at in this way:

~~~ ruby
a.values_at(*[1,2,3]*100_000)
~~~

I get this error:

~~~
Exception: SystemStackError: stack level too deep
--
0: (pry):6:in `__pry__'

~~~
 



-- 
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>