From: Robert Feldt Date: 2001-03-06T17:12:17+09:00 Subject: [ruby-talk:12104] Re: RCR: replacing 'caller' Hi, On Tue, 6 Mar 2001, Yukihiro Matsumoto wrote: > In message "[ruby-talk:12097] RCR: replacing 'caller'" > on 01/03/06, Robert Feldt writes: > > |IMHO, 'caller' would be much more useful if you could know/access the > |method and object that called you. Therefore I submit this RCR: > | > |Replace 'caller' with 'call_stack' returning an array of arrays each with > |the format: > | > |[object_called, method_called_id, args, file_with_call, line_for_call] > | > |'call_stack' takes a level parameter (almost) in the same way as 'caller'. > > Hmm, do you think call_stack is the best name? > I'd happy to merge this patch if my name concern resolved. > Not sure. 'callers' might work or 'invocation_stack' or 'execution_stack' as in pickaxe book but I'd prefer 'call_stack'. What sayeth the community? BTW, on the "Ruby & AOP" thread: 'trap_calls' may be a misnomer since we're really trapping invocations of methods (AspectJ for example distinghuishes between trapping calls (all calls within the body of a specified method are trapped) and trapping invocations/"call receptions" (all calls to a specified method are trapped)). In line with this maybe we should use 'trap_calls_to'? Or is this "hair splitting"? Naming is difficult! /Robert BTW, I have a problem with irb and latest snapshot. Is it me who have messed things up or is it a bug? $ irb /usr/local/lib/ruby/1.7/irb/ruby-lex.rb:201:in `initialize_input': uninitialized constant EXPR_BEG (NameError) from /usr/local/lib/ruby/1.7/irb/ruby-lex.rb:213:in `each_top_level_stat ement' from /usr/local/lib/ruby/1.7/irb/main.rb:352:in `eval_input' from /usr/local/lib/ruby/1.7/irb/main.rb:62:in `start' from /usr/local/lib/ruby/1.7/irb/main.rb:61:in `catch' from /usr/local/lib/ruby/1.7/irb/main.rb:61:in `start' from /usr/local/bin/irb:19 feldt@CHALMERS_1500 /usr/local/lib/ruby/1.7 $ ruby -v ruby 1.7.0 (2001-03-05) [i686-cygwin]