Professional Web Applications Themes

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

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 :(...

  1. #1

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

    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 Guest

  2. #2

    Default Re: 1.8.0-preview7 block-to-super bug/change or behaviour

    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

    nobu.nokada@softhome.net Guest

  3. #3

    Default Re: 1.8.0-preview7 block-to-super bug/change or behaviour

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

Similar Threads

  1. how to block change event of data grid
    By leimin3113591 in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: April 11th, 01:59 AM
  2. Newline after <?..?> block behaviour configurable?
    By Stefan Weiss in forum PHP Development
    Replies: 0
    Last Post: October 22nd, 07:43 PM
  3. 1.8.0 change to super and nil block argument
    By Joel VanderWerf in forum Ruby
    Replies: 1
    Last Post: August 11th, 08:40 AM
  4. Bad magic number in super-block (urgent advice needed)
    By Loren Coe in forum Linux Setup, Configuration & Administration
    Replies: 3
    Last Post: July 3rd, 12:35 PM
  5. How to change partition number & block size
    By spagi in forum Linux Setup, Configuration & Administration
    Replies: 8
    Last Post: June 28th, 12:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139