From: thunk on 26 Mar 2010 21:10 Hi again, SPECIFIC QUESTION: How can I fetch the Class name of the calling Object? (The module that contains the class of the calling Object might be useful/necessary in the future.) NOTES: I checked the 'caller' stack and it doesn't show up there. Searched this forum, googled, and it is was not found. The calling Method was found right off. A SNIPPIT FROM MY TEST CODE: (this might provide some clue to the general utility?) class TestingClass def initialize @wB = WhiteBoard.new @satz1 = end def calling_method1 age = @wB.get_note(:AGE, 19) puts "defaulted age = " + age.to_s @wB.put_note(:test, 12) @wB.put_note(:test, 16) #just overwrites, handy?! age = @wB.get_note(:test) puts "age = " + age.to_s # => 16 end def calling_method2 @wB.set_id( :ALF ) @wB.put_satz(:TestingClass, :calling_method2, @satz1) #put_satzAr(.... pushes the satz struct onto a automatic stack #would become just #@wB.put_satz(@satz1) #....if I could fetch the Class end def calling_method3 @wB.set_id( :ALF ) satz = @wB.get_satz(:TestingClass, :calling_method2) puts "satz in calling_method3 = " + satz.inspect #(this works) end end
From: thunk on 26 Mar 2010 23:07 On Mar 26, 9:45 pm, Ryan Davis <ryand-r...(a)zenspider.com> wrote: > On Mar 26, 2010, at 18:15 , thunk wrote: > > > def calling_method1 > > age = @wB.get_note(:AGE, 19) > > puts "defaulted age = " + age.to_s > > @wB.put_note(:test, 12) > > @wB.put_note(:test, 16) #just overwrites, handy?! > > age = @wB.get_note(:test) > > puts "age = " + age.to_s # => 16 > > end > > This is not a test (nor is any of the rest of your file). > > Also, it hints very much that you're reimplementing rinda, as I've suspected for a while. Google for Linda TupleSpace for more info. 1. I don't know from "tuples" - all I "need" are hashes. Somebody also mentioned Graphs. I'm happy with my set of conventions and these hashes for my purposes. 2. I looked at Rinda and didn't understand it. 3. Anything that works for me in 60 lines and I have complete control over is not something I am personally interested in replacing with something I don't understand or see a need to. 4. Any thing I write that "tests" is a "test" to my simple logic. I'm spending a great deal of time implementing self-tests and all such and have written and supervised some pretty big projects in other languages. I'm in awe of what Ruby can do but I don't really think you guys, as awesome as you all are, have any place telling that I'm not testing. Save that for the rookies. Or maybe you have redefined what "testing" means. As an old QC guy, i'd have to wonder if you can do that.
From: thunk on 26 Mar 2010 23:35 On Mar 26, 10:07 pm, thunk <gmkol...(a)gmail.com> wrote: > On Mar 26, 9:45 pm, Ryan Davis <ryand-r...(a)zenspider.com> wrote: > > > On Mar 26, 2010, at 18:15 , thunk wrote: > > > > def calling_method1 > > > age = @wB.get_note(:AGE, 19) > > > puts "defaulted age = " + age.to_s > > > @wB.put_note(:test, 12) > > > @wB.put_note(:test, 16) #just overwrites, handy?! > > > age = @wB.get_note(:test) > > > puts "age = " + age.to_s # => 16 > > > end > > > This is not a test (nor is any of the rest of your file). > > > Also, it hints very much that you're reimplementing rinda, as I've suspected for a while. Google for Linda TupleSpace for more info. > > 1. I don't know from "tuples" - all I "need" are hashes. Somebody > also mentioned Graphs. I'm happy with my set of conventions and these > hashes for my purposes. > > 2. I looked at Rinda and didn't understand it. > > 3. Anything that works for me in 60 lines and I have complete control > over is not something I am personally interested in replacing with > something I don't understand or see a need to. > > 4. Any thing I write that "tests" is a "test" to my simple logic. I'm > spending a great deal of time implementing self-tests and all such and > have written and supervised some pretty big projects in other > languages. I'm in awe of what Ruby can do but I don't really think > you guys, as awesome as you all are, have any place telling that I'm > not testing. Save that for the rookies. Or maybe you have redefined > what "testing" means. As an old QC guy, i'd have to wonder if you can > do that. Project perspective wise this "WhiteBoard" thing is a very small part of a much larger project. It looks like it can have a role in storing and retrieving "communications" between DSLs that are handling the "Boids" and between HelperClasses and the end resulting "WorkSheets" (back into technish). Line of code wise this is maybe 80/4000 if you don't count the Boids (another 4,000 and growing rapidly). .....just for some perspective.
From: thunk on 27 Mar 2010 04:14 OK! SUMMARY I have been to the mountain top and gotten this from a Ruby Guru - there are two ways of getting at the class but one way is a hack, and not a pretty one, or even what appears to be a reliable one. And the 2nd way, using binding, seems to require a param - which is what I was trying avoid. RAMBLINGS Since I've become totally stuck on this "keyLess entry" for now, at least to play with for awhile, I have decided to do something a little strange - I'm going to require that all the method names in all the involved sending libraries are unique - a non-unique new method will just need a tweak and the whole system can work on the method name alone as the key. A nice friendly message will come up and tell a contributing writer that his carefully thought out name needs to get tweaked - or I could append a tie breaker to it - and just give it to him. LINK TO A GIST - It might have some use for somebody with enough changes, it sure has been interesting to play with. http://gist.github.com/345646
From: thunk on 27 Mar 2010 06:40
On Mar 27, 4:14 am, Ryan Davis <ryand-r...(a)zenspider.com> wrote: > On Mar 26, 2010, at 20:10 , thunk wrote: > > > 1. I don't know from "tuples" - all I "need" are hashes. Somebody > > also mentioned Graphs. I'm happy with my set of conventions and these > > hashes for my purposes. > > 2. I looked at Rinda and didn't understand it. > > ... and the rest > > DTM > > you flipped the bozo bit. |