From: matz@... (Yukihiro Matsumoto) Date: 2001-05-10T13:45:13+09:00 Subject: [ruby-talk:14934] Re: Class/Module Information Hi, In message "[ruby-talk:14930] Re: Class/Module Information" on 01/05/10, "John Kaurin" writes: |> Confucius once said "accept things as they are". ;-) | |I am sure it unwise to contradict Confucius. Unfortunately, I |cannot recall anyone ever saying I was wise ;-( Don't take my words too serious (as always). I'm not even sure it was really Confucius or not. |> Included Modules: |> |> current Ruby implementation does not distinguish direct included |> modules (B, this case) and indirect included modules (A, this |> case). | |A possible addition to a future version? Possible. But requires discssion before adding it. |> Class Variables: |> |> same as above. it might be useful to add optional argument to |> restrict search for this class/module only. | |This would cover most of my wants. This too requires discussion. RCR? So there're three separate (but related) possible RCRs: Module#included_modules(includeIndirect=true) Module#constants(includeSuper=true) Module#class_variables(includeSuper=true) My concern is default value of optional argument contradicct with that of Module#instance_methods(includeSuper=false), etc. Maybe I'm too worried. |> Instance Variables: |> |> In Ruby, instance variables belong to each instance, not a class nor |> module, so that you can get their information from module. | |Is this not also true for instance methods? Yet, instance_methods |returns the list I am interested in since it restricts superclass information |by default. Instance methods (which belong to classes/modules) and instance variables (which belong only to each instance) are different in Ruby. In other words, instances variables are defined indirectly via instance methods. You may need to time to get it if you have C++/Java background. matz.