Issue #20444 has been updated by esad (Esad Hajdarevic).
nobu (Nobuyoshi Nakada) wrote in #note-3:
I'm curious what your use case is.
Although I don't know the reason why `StopIteration#initialize` does not have the
argument for `result`, it would be difficult to change it now because of the backward
compatibility.
I think my use case is a bit of an edge case - I am passing a block into a Ractor where it
runs in a loop. This way I can control exit from the loop, but obviously this can be also
refactored into a normal result value of the block and "manual" looping control
depending on the result.
----------------------------------------
Feature #20444: Kernel#loop: returning the "result" value of StopIteration
doesn't work when raised directly
https://bugs.ruby-lang.org/issues/20444#change-108084
* Author: esad (Esad Hajdarevic)
* Status: Feedback
----------------------------------------
There was a
https://bugs.ruby-lang.org/issues/11498 a while ago which was merged in, but I
was surprised to find out that raising `StopIteration` in a loop like
`loop { raise StopIteration.new(3) }`
returns nil and not 3.
--
https://bugs.ruby-lang.org/