Difference in module_eval taking block vs. taking string (1.8 bug?)

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default Difference in module_eval taking block vs. taking string (1.8 bug?)

    The following code:

    class Klass
    end
    p Klass.instance_methods(false)
    Klass.module_eval do
    def hello
    puts 'hello'
    end
    end
    p Klass.instance_methods(false)
    Klass.module_eval("def hello2() puts 'hello2'; end")
    p Klass.instance_methods(false)

    produces this output in 1.8.0pre3:

    []
    []
    ["hello2"]

    but in 1.6.8 it produces:

    []
    ["hello"]
    ["hello2", "hello"]

    Is this a bug in 1.8 or a feature?


    Jim Cain Guest

  2. Similar Questions and Discussions

    1. Buffering taking too long
      I have Flash 8 installed and it does work but it is taking about twenty minutes to buffer a three to four minute video. I don't think it is the...
    2. Taking up 50% CPU
      Why does contribute consume 50% of my CPU when it goes out of the foreground. All I have to do is Apple + Tab and watch my activity monitor light...
    3. Taking screenshot...
      Anyone knows how to take a screenshot with lingo so i can pass it to a flash member?? Thanks! ;)
    4. Jrun.exe taking 100% of CPU
      Please, help! I have 100% CPU usage on my server hosting CF MX 6.1 server. There are only about 50 users on the application and it is local intranet...
    5. rsh taking 7 min to respond???? please help
      Hi all, I have an RS6000 running AIX v 5.1.... I have installed gnu cvs 1.11.7 and I would like to use the RS6000 as my cvs repository. The...
  3. #2

    Default Re: Difference in module_eval taking block vs. taking string (1.8 bug?)

    Hi,

    In message "Difference in module_eval taking block vs. taking string (1.8 bug?)"
    on 03/07/18, Jim Cain <list@jimcain.us> writes:

    |Is this a bug in 1.8 or a feature?

    It was a bug fixed July 2 2003.

    Wed Jul 2 13:22:39 2003 Yukihiro Matsumoto <matz@ruby-lang.org>

    * eval.c (rb_yield_0): override visibility mode for module_eval
    etc. (ruby-bugs-ja PR#505)


    matz.

    Yukihiro Matsumoto Guest

Posting Permissions

  • You may not post new threads
  • You may 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