Re: Differences between irb and ruby.
by Logan Capaldo other posts by this author
Jun 30 2006 9:33PM messages near this date
Re: Differences between irb and ruby.
|
Re: Differences between irb and ruby.
On Jul 1, 2006, at 12:15 AM, Minkoo Seo wrote:
> Hi austin.
>
> On 7/1/06, Austin Ziegler <halostatue@[...].com> wrote:
> >
> > irb behaves differently than Ruby might otherwise behave because all
> > of the code entered is eval-ed when it's in a "complete" state for
> > the
> > Ruby interpreter to use.
> >
>
> I'm afraid that I don't understand "all of the code entered is eval-ed
> when it's in a "complete" state for the Ruby interpreter to use"
> means.
>
> What do you mean by 'evaled' and 'complete state'? And Why are the
> visibility differences happening?
>
> Sincerely,
> Minkoo Seo
irb is a repl written in ruby which means it uses eval (or
module_eval or instance_eval). Now whether intentionally or not (one
could probably find out by looking at the source), all irb sessions
basically have an implicit
irb(main):000:0> public
at the top.
If you want it to act more like a bog-standard ruby top-level, you
can type private at the start of your irb session. (unfortunately
putting it in your .irbrc won't work)
Thread:
Minkoo Seo
Ezra Zygmuntowicz
Minkoo Seo
Ezra Zygmuntowicz
Austin Ziegler
Minkoo Seo
Logan Capaldo
Mauricio Fernandez
|