What kind of scoping does Ruby use?Static or Dynamic

Discussion in 'Ruby' started by Noyan Aydin, Dec 18, 2006.

  1. Noyan Aydin

    Noyan Aydin Guest

    What kind of scoping ruby use, even if it has lots of scoping rules
    which was supported by adding different parameters infront of variable
    names and using different character size. We do not decide what kind of
    scoping does Ruby use? Dynamic or static scoping. Thank you in advance.

    --
    Posted via http://www.ruby-forum.com/.
     
    Noyan Aydin, Dec 18, 2006
    #1
    1. Advertising

  2. On 18.12.2006 16:56, Noyan Aydin wrote:
    > What kind of scoping ruby use, even if it has lots of scoping rules
    > which was supported by adding different parameters infront of variable
    > names and using different character size. We do not decide what kind of
    > scoping does Ruby use? Dynamic or static scoping. Thank you in advance.


    Static.

    robert
     
    Robert Klemme, Dec 18, 2006
    #2
    1. Advertising

  3. Noyan Aydin

    Ken Bloom Guest

    On Tue, 19 Dec 2006 00:56:02 +0900, Noyan Aydin wrote:

    > What kind of scoping ruby use, even if it has lots of scoping rules
    > which was supported by adding different parameters infront of variable
    > names and using different character size. We do not decide what kind of
    > scoping does Ruby use? Dynamic or static scoping. Thank you in advance.
    >


    Ruby uses static scoping in the basic syntax, however the use of eval with
    a binding, or instance_eval (even when hidden very deep in other
    methods) can change the context in which a block or string of code is
    evaluated, causing it to have different scoping from the surrounding code
    (but still static).

    --Ken Bloom

    --
    Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
    Department of Computer Science. Illinois Institute of Technology.
    http://www.iit.edu/~kbloom1/
     
    Ken Bloom, Dec 18, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    379
    Robert Klemme
    Jan 6, 2006
  2. SPECTACULAR
    Replies:
    3
    Views:
    951
    shrestha
    Jan 1, 2007
  3. Philip Amadeo Saeli

    Noob Q: ruby block scoping question (ruby TK)

    Philip Amadeo Saeli, Apr 30, 2008, in forum: Ruby
    Replies:
    4
    Views:
    133
    Joel VanderWerf
    May 1, 2008
  4. PerlFAQ Server
    Replies:
    0
    Views:
    365
    PerlFAQ Server
    Jan 6, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    267
    PerlFAQ Server
    Apr 15, 2011
Loading...

Share This Page