there is some seriously black art happening here:

i added the following code to callbacks.rb

    def self.append_features(base) #:nodoc:
      super

$i ||= 0
p $i
p caller.last
$i += 1

      ...
      ...
      ...

and then fired up ./script/console.  this is what it prints:

  harp:~/ror/bug > ./script/console
  0
  "./script/console:2"
  Loading development environment.
  0
  "/home/ahoward/bin/irb:13"
  ...

how on earth is that possible!?  what has been done?  just to illustrate it
would be as if this code:


    harp:~/ror/bug > cat a.rb
    module M
      def self::append_features other
        $i ||= 0
        p $i
        p caller.last
        $i += 1
      end
    end

    class C
      include M
      include M
    end

printed out '0' and then '0' but, of course, it does not:

    harp:~/ror/bug > irb -r a.rb
    0
    "/home/ahoward/bin/irb:13"
    1
    "/home/ahoward/bin/irb:13"


can someone shed some light on this?

-a
--
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to