From: "Hal E. Fulton" Date: 2003-03-31T07:57:35+09:00 Subject: Re: how to catch any exception "eval" throws ----- Original Message ----- From: "Meinrad Recheis" Newsgroups: comp.lang.ruby To: "ruby-talk ML" Sent: Sunday, March 30, 2003 4:31 PM Subject: how to catch any exception "eval" throws > i tried > > begin > eval( str ) > rescue > puts $! > end > > but my program terminates if str contains erraneous expressions > why doesn t rescue catch say "parser errors"? I can never remember exactly how this works, but the default is to catch a certain family of errors (perhaps StandardError? I'm probably misleading you). Putting a very general class there would help, perhaps 'rescue Exception' -- but I'm not sure that is correct. > this is from the book: > > eval( aString [, aBinding [ file [ line ] ] ]) -> anObject > > i have no guess how to use this. what do the nested [] mean? That simply means that the parameters are independently optional. These are all valid: eval(a,b,f,l) eval(a,b,f) eval(a,b eval(a) HTH, Hal