From: Mathieu Bouchard Date: 2001-07-10T07:30:14+09:00 Subject: [ruby-talk:17561] Re: Constants and Variables On Tue, 10 Jul 2001, Martin J. Laubach wrote: > The first point is the definition of constants (a symbol starting > with an upper case letter) -- WTF was it done that way, mixing > syntax and semantics, instead of having a "const" attribute. What are called "constants" in Ruby is a namespace (or really, a graph of namespaces), just like there is the global namespace ($), the object namespace (@), the local namespaces, the method namespaces. The constants namespaces are made to hold classes by name and such. (global namespace is for stuff that *really* is global.) > After all, if you go down that way, ruby could define protected methods > as "starting with an underscore" or such. Well, it can as well not do that too. You can drink one beer, and the step to a second beer is not hard to walk, but some people actually are willing to drink *exactly* one beer. You see? =) > I'd rather have a const attribute which makes the object immutable. If you want objects that don't change, try Object#freeze, Object#frozen?. > One of the other things I miss dearly is a way to create a new > block-local variable. I have been bitten by creating a local variable is an implicit thing that happens upon assignment. local variable is searched in current namespace and recursively in its parents, then if not found, is created in the current. block parameter passing is assignment, single or multiple. matju