From: "Hal E. Fulton" Date: 2002-04-18T03:20:20+09:00 Subject: Re: Ways methods return values ----- Original Message ----- From: "Sean O'Dell" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Wednesday, April 17, 2002 12:05 PM Subject: Ways methods return values > I know in Ruby, the last evaluation is returned by a method and you can also > explicitly "return" a value, but I was wondering if there was a way to do > something I became accustomed to while programming in Pascal. > > In Pascal, functions have a local variable with the same name of the > function that you can assign to at any location within the function and no > matter what causes the function to return (aside from an exception), the > return value will be whatever you assigned to that variable. [snip] This is interesting... I'm a Pascal oldtimer myself, and I can understand the motivation for this. However, it's not obvious to me there's a way to do it in Ruby. There are future plans for a way to "hook" into the entry and exit of a method, if I understand correctly... that might be a useful line of research for a future way to do this... that's assuming the reflection API has a way to retrieve local vars for a method, which I can't recall at the moment. Sorry no help. Hal Fulton