From: Chirantan Date: 2008-01-24T14:04:56+09:00 Subject: Re: Help with eval On Jan 24, 5:50 am, "ara.t.howard" wrote: > On Jan 23, 2008, at 4:06 PM, Keith Carter wrote: > > > Wow. That is weird. I think evals are scoped as blocks. I'm going to > > play with this for a bit. > > variables created in eval can only been seen from eval. when you are > irb you are already inside eval. there are some exceptions - search > the archives. > > if you post what you are trying to accomplish perhaps someone can > help - no pattern that relies on eval creating vars in the local > scope is going to pan out too well without a little dsl or some > hackery - eval just won't suffice. > > regards. > > a @http://codeforpeople.com/ > -- > share your knowledge. it's a way to achieve immortality. > h.h. the 14th dalai lama begin eval("bar=1") puts bar end Gives me and error too. but if I do bar = 0 begin eval("bar=1") puts bar end It works! I am a ruby rookie so I dont know why this is so.