Fiber exists before require 'fiber'

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
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

On Jun 13, 2008, at 2:16 PM, Roger P. wrote:

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

On Fri, Jun 13, 2008 at 3:21 PM, Dave T. [email protected] wrote:

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

Nope, that’s not confusing at all! :wink:


Avdi

Home: http://avdi.org
Developer Blog: http://avdi.org/devblog/
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com

Roger P. wrote:

is this more like ‘supplemental fiber methods’ or something?

http://www.infoq.com/news/2007/08/ruby-1-9-fibers

Dave T. wrote:

On Jun 13, 2008, at 2:16 PM, Roger P. wrote:

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

Thanks that answered it.
-R