From: pjb@... (Pascal J. Bourguignon) Date: 2009-01-26T04:33:09+09:00 Subject: Re: How can I get the arguments passed to the caller. Stefan Kanev writes: > [Note: parts of this message were removed to make it a legal post.] > > Hey guys. > > I have a rather weird question. I want to write a function that > programatically determines the arguments passed to its caller. Say, if i do > > $stuff = [] > > def bar(arg) > foo > end > > def foo > first_arg = .... > $stuff << first_arg > end > > bar(42) I don't think this is possible. > # By this point, $stuff would be [42] But to get this result you could write: (def bar(*args) ($stuff = args) end) (bar 42) $stuff --> [42] > I know it is quite the contrived question, but I'm not interested in doing > something practical. Any leads? -- __Pascal Bourguignon__