Fiber exists before require 'fiber'

R

Roger Pack

So, in 1.9 it appears that the Fiber class exists before you've required
fiber. Thoughts?

irb(main):001:0> Fiber
=> Fiber
irb(main):002:0> Fiber.current
NoMethodError: undefined method `current' for Fiber:Class
from (irb):2
from /Users/rogerpack/19/bin/irb:12:in `<main>'
irb(main):003:0> require 'fiber'
=> true
irb(main):004:0> Fiber.current
=> #<Fiber:0x11bb10>

And, oddly, only fiber.bundle exists, not fiber.rb

is this more like 'supplemental fiber methods' or something?
Anyway it works, I'm just curious.
Thanks!
-R
 
D

Dave Thomas

is this more like 'supplemental fiber methods' or something?
Anyway it works, I'm just curious.

Without the require, you get asymmetric fibers: they're useful as
generators. With the require, you get symmetric ones, which are closer
to coroutines.


Dave
 
R

Roger Pack

Dave said:
Without the require, you get asymmetric fibers: they're useful as
generators. With the require, you get symmetric ones, which are closer
to coroutines.


Dave

Thanks that answered it.
-R
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top