Skip to content

Commit d87a566

Browse files
committed
Delete Ractor.yield
1 parent de0c675 commit d87a566

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

core/ractor.rbs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -397,46 +397,6 @@ class Ractor
397397
#
398398
def self.store_if_absent: [A] (Symbol) { (nil) -> A } -> A
399399

400-
# <!--
401-
# rdoc-file=ractor.rb
402-
# - Ractor.yield(msg, move: false) -> nil
403-
# -->
404-
# Send a message to the current ractor's outgoing port to be accepted by #take.
405-
#
406-
# r = Ractor.new {Ractor.yield 'Hello from ractor'}
407-
# puts r.take
408-
# # Prints: "Hello from ractor"
409-
#
410-
# This method is blocking, and will return only when somebody consumes the sent
411-
# message.
412-
#
413-
# r = Ractor.new do
414-
# Ractor.yield 'Hello from ractor'
415-
# puts "Ractor: after yield"
416-
# end
417-
# wait
418-
# puts "Still not taken"
419-
# puts r.take
420-
#
421-
# This will print:
422-
#
423-
# Still not taken
424-
# Hello from ractor
425-
# Ractor: after yield
426-
#
427-
# If the outgoing port was closed with #close_outgoing, the method will raise:
428-
#
429-
# r = Ractor.new do
430-
# close_outgoing
431-
# Ractor.yield 'Hello from ractor'
432-
# end
433-
# wait
434-
# # `yield': The outgoing-port is already closed (Ractor::ClosedError)
435-
#
436-
# The meaning of the `move` argument is the same as for #send.
437-
#
438-
def self.yield: (untyped obj, ?move: boolish) -> untyped
439-
440400
# <!--
441401
# rdoc-file=ractor.rb
442402
# - <<(...)

test/stdlib/Ractor_test.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,6 @@ def test_store_if_absent
8686
Ractor, :store_if_absent, :test_store_if_absent, &->(_x) { true }
8787
)
8888
end
89-
90-
def test_yield
91-
omit "Ractor#yield is not implemented" if RUBY_VERSION >= "3.5"
92-
93-
Ractor.new(Ractor.current) { |r| loop { r.take } }
94-
95-
assert_send_type "(Integer) -> untyped",
96-
Ractor, :yield, 42
97-
assert_send_type "(Integer, move: true) -> untyped",
98-
Ractor, :yield, 42, move: true
99-
assert_send_type "(Integer, move: false) -> untyped",
100-
Ractor, :yield, 42, move: false
101-
end
10289
end
10390

10491
class RactorInstanceTest < Test::Unit::TestCase

0 commit comments

Comments
 (0)