[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

What kind of scoping does Ruby use?Static or Dynamic

Noyan Aydin

12/18/2006 3:56:00 PM

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-....

2 Answers

Robert Klemme

12/18/2006 4:40:00 PM

0

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

Ken Bloom

12/18/2006 5:08:00 PM

0

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...