rb_iterate is obsolete since 1.9 but is not marked as deprecated for C compilers
Marked as obsolete in https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure.
I think it would be a good to mark it as deprecated so the few places still using that migrate to e.g.
These 2 places are still using rb_iterate():
ext/openssl/ossl_ssl.c:595: rb_iterate(rb_each, protocols, ssl_npn_encode_protocol_i, encoded);Should use rb_block_call instead: https://github.com/ruby/openssl/pull/448
ext/racc/cparse/cparse.c:302: rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v);Unintentional, fix in https://github.com/ruby/racc/pull/165
Right now there is special logic inside
rb_funcall()/vm_call0_body() to handle the block magically passed by rb_iterate(), and I think it would be good to clean that up once
rb_iterate() is gone.
FYI, TruffleRuby is recently no longer doing that magic behavior for such an old deprecated method:
Updated by Eregon (Benoit Daloze) 2 months ago
- Status changed from Open to Closed
Applied in changeset git|fd0df9c4fb36597e5e3f500670b29dbd77a14eca.
Emit deprecatation warnings for rb_iterate()
- It is obsolete since 1.9, see https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure and [Misc #18025]