Wednesday, October 12, 2005

Access Control for Ruby Class

The following words are from Programming Ruby: The Pragmatic Programmers' Guide:

"Ruby differs from other OO languages in another important way. Access control is determined dynamically, as the program runs, not statically. You will get an access violation only when the code attempts to execute the restricted method."

That's because those "public"/"protected"/"private" you saw are actually implemented as functions! The parser does not even know them. As the program runs, those functions are called and then you know if there is any errors.

0 Comments:

Post a Comment

<< Home