-
Notifications
You must be signed in to change notification settings - Fork 211
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
_EnumEach interface #424
Comments
Could you show me an example that requires no-block-given version? |
Currently, the way it's defined, the rbs definition doens't match this case. |
This is the definition you are looking for. It's basically correct, except the second should return |
I was actually arguing for this definition to be part of a common interface, instead of being rewritten in every project implementing |
It could definitely be useful as a shorthand, but maybe should be named something different like I think |
I think I got the point. class Foo
def each
yield 1
yield 2
end
include Enumerable
end
Foo.new.each # => error!! Okay, we need to revise the definition of the interface! |
@soutaro just for clarity, I'm not arguing for a revision of the existing one, but to add a new one. The reasoning is, the current |
https://github.com/ruby/rbs/blob/c64d1f5ba5a4fbc95ffb1d72d783ee39b17d60fe/stdlib/builtin/builtin.rbs already contains an
_Each
interface, but one where an enumerable can also be returned is missing. These are fairly common btw. Here's a proposal:The text was updated successfully, but these errors were encountered: