From: Andreas Schwarz Date: 2007-07-18T18:21:38+09:00 Subject: Optional return values Hi, I have a few methods that check permissions, e.g. unless user.can_view?(object) puts "go away" end What I want do do now is add the possibility to give the caller more information why the user doesn't have permission. I want to make it backwards compatible, so returning [false, NotInGroupError(:group => 'xyz')] is not an option. The only thing I could think of is giving the function a String or Array that is modified in place: def can_view?(object, message='') if foo.bar message.replace('some error message') false else true end end That's how one would have to do it in C or VHDL. It does seem kinda un-rubyish though. Is there some obvious way to do this better that I'm missing? Thanks Andreas -- Posted via http://www.ruby-forum.com/.