-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling Range(_, Nil)#size hangs in runtime #8151
Comments
It looks like it hangs at runtime, which I guess is expected, though we could try to detect it somehow... it's really hard, though. |
Advice: always do |
I guess we could overload |
We could. It would also hang when doing map, or select or any of the other enumerable methods. |
could we have another class called |
This is expected behaviour. Every language will hang if you try and perform an infinite amount of work. What would |
For this specific case, It would probably make sense to override this method anyway, because for the most common use case with integers, the size can be calculated directly. It doesn't need to iterate through the elements as |
It would be nice to have an |
@wontruefree IMO if anything |
@wontruefree |
Code below is enough to kill the compiler:
(0..).size
Infinite
Iterator
s are having the same issue btw:The text was updated successfully, but these errors were encountered: