1.8.0-preview7 block-to-super bug/change or behaviour

Discussion in 'Ruby' started by Kero van Gelder, Aug 3, 2003.

  1. Hi!

    Up to 1.8.0-preview6, the code below prints three lines (A, B, A).
    1.8.0-preview7 prints only two (A, B).

    What's going on?

    Bye,
    Kero.

    class A
    def initialize(&block)
    p "A #{block}" if block_given?
    end
    end

    class B < A
    def initialize(&block)
    super() { puts "world" }
    p "B #{block}" if block_given?
    end
    end

    B.new() { puts "hello" } # results in two lines printed, OK
    B.new() # nothing printed :(
    Kero van Gelder, Aug 3, 2003
    #1
    1. Advertising

  2. Kero van Gelder

    Guest

    Hi,

    At Sun, 3 Aug 2003 20:25:23 +0900,
    Kero van Gelder wrote:
    > Up to 1.8.0-preview6, the code below prints three lines (A, B, A).
    > 1.8.0-preview7 prints only two (A, B).
    >
    > What's going on?


    Seems [ruby-talk:77654] was wrong.


    Index: eval.c
    ===================================================================
    RCS file: /cvs/ruby/src/ruby/eval.c,v
    retrieving revision 1.503
    diff -u -2 -p -r1.503 eval.c
    --- eval.c 3 Aug 2003 10:25:32 -0000 1.503
    +++ eval.c 3 Aug 2003 13:56:45 -0000
    @@ -5241,5 +5241,5 @@ rb_call_super(argc, argv)
    }

    - PUSH_ITER(rb_block_given_p()?ITER_PRE:ITER_NOT);
    + PUSH_ITER(ruby_iter->iter || rb_block_given_p() ? ITER_PRE : ITER_NOT);
    result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3);
    POP_ITER();


    --
    Nobu Nakada
    , Aug 3, 2003
    #2
    1. Advertising

  3. >> Up to 1.8.0-preview6, the code below prints three lines (A, B, A).
    >> 1.8.0-preview7 prints only two (A, B).
    >>
    >> What's going on?

    >
    > Seems [ruby-talk:77654] was wrong.

    [snip patch]

    Yup, that's it.

    Thanks!
    Kero.
    Kero van Gelder, Aug 3, 2003
    #3
    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. Guest

    super.super.super how?

    Guest, Feb 19, 2005, in forum: Java
    Replies:
    24
    Views:
    10,743
    Darryl Pierce
    Feb 24, 2005
  2. Yukihiro Matsumoto

    ruby 1.8.0 preview7

    Yukihiro Matsumoto, Aug 1, 2003, in forum: Ruby
    Replies:
    7
    Views:
    91
    Kero van Gelder
    Aug 2, 2003
  3. daz
    Replies:
    5
    Views:
    101
  4. Replies:
    1
    Views:
    146
  5. Brian Candler

    preview7 tarball size

    Brian Candler, Aug 4, 2003, in forum: Ruby
    Replies:
    5
    Views:
    119
    Hidetoshi NAGAI
    Aug 4, 2003
Loading...

Share This Page