ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved