Fiber exists before require 'fiber'

Discussion in 'Ruby' started by Roger Pack, Jun 13, 2008.

  1. Roger Pack

    Roger Pack Guest

    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
    --
    Posted via http://www.ruby-forum.com/.
     
    Roger Pack, Jun 13, 2008
    #1
    1. Advertising

  2. Roger Pack

    Dave Thomas Guest

    On Jun 13, 2008, at 2:16 PM, Roger Pack 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
     
    Dave Thomas, Jun 13, 2008
    #2
    1. Advertising

  3. Roger Pack

    Avdi Grimm Guest

    Avdi Grimm, Jun 13, 2008
    #3
  4. Roger Pack

    Roger Pack Guest

    Dave Thomas wrote:
    > On Jun 13, 2008, at 2:16 PM, Roger Pack 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
    --
    Posted via http://www.ruby-forum.com/.
     
    Roger Pack, Jun 16, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Akihiro KAYAMA

    fiber(cooperative multi-threading)

    Akihiro KAYAMA, Dec 22, 2007, in forum: Python
    Replies:
    17
    Views:
    629
    Bjoern Schliessmann
    Dec 28, 2007
  2. Replies:
    0
    Views:
    269
  3. pluskid
    Replies:
    1
    Views:
    114
    Chiyuan Zhang
    Feb 19, 2008
  4. Suraj Kurapati

    Ruby 1.9 - equivalent of Fiber.current ?

    Suraj Kurapati, Mar 2, 2008, in forum: Ruby
    Replies:
    2
    Views:
    126
    Suraj Kurapati
    Mar 2, 2008
  5. Iñaki Baz Castillo

    How to know whether current Fiber is the root Fiber?

    Iñaki Baz Castillo, Apr 8, 2011, in forum: Ruby
    Replies:
    4
    Views:
    318
    Robert Klemme
    Apr 11, 2011
Loading...

Share This Page