[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03834] Re: Order of overwriting

From: ts <decoux@...>
Date: 2000-07-05 15:39:06 UTC
List: ruby-talk #3834
>>>>> "A" == Aleksi Niemel=E4?= <iso-8859-1> writes:

A> Now I just have to give some time for my mental model to adjust. It just got
A> used to the idea the Ruby reads source and processes it as it goes, like:

 Yes, it do something like this

A> class Foo          # change to a here-comes-a-class-definition(-remember-
A>                    # to-scan-through-the-definition-first)
A>   def foo
A>   end
A>   include "Bar"    # whee, here we have it, now we can start to read method
A>                    # definitions
A> end

 not really

pigeon% cat b.rb
class Foo 
   def foo
      1 + 1
   end
   include Math
end
pigeon%

pigeon% ruby -Dtx b.rb
LOAD_FILE HRF b.rb
==============================> 
 
NEWLINE <b.rb:6>
 
CLASS Foo
  SCOPE
    BLOCK
      NEWLINE <b.rb:2>
 
      DEFN foo 
        SCOPE
          BLOCK
            ARGS ()
            NEWLINE <b.rb:3>
            CALL + 
              LIT 1
              ARRAY
                LIT 1
 
      NEWLINE <b.rb:5>
      FCALL include 
        ARRAY
          CVAR Math
 
 
==============================> 
 
rb_eval <b.rb:6> : NEWLINE
rb_eval <b.rb:6> : CLASS Foo
 
rb_eval <b.rb:2> : BLOCK
rb_eval <b.rb:2> : NEWLINE
rb_eval <b.rb:2> : DEFN foo
rb_eval <b.rb:5> : NEWLINE
rb_eval <b.rb:5> : FCALL include
rb_eval <b.rb:5> : CVAR Math
 
pigeon% 


 The first part (between ==============================>) are the node
 generated when it read the source.

 The second part, the execution of these nodes.

 It process 'DEFN foo' before the include


Guy Decoux

In This Thread

Prev Next